Cov txheej txheem:

Kuv yuav siv Kubernetes ConfigMap li cas?
Kuv yuav siv Kubernetes ConfigMap li cas?

Video: Kuv yuav siv Kubernetes ConfigMap li cas?

Video: Kuv yuav siv Kubernetes ConfigMap li cas?
Video: Kubernetes ConfigMap и Secret как Kubernetes Volumes | Демо 2024, Kaum ib hlis
Anonim

Configure a Pod siv ConfigMap

  1. Tsim a ConfigMap .
  2. Txhais lub thawv ib puag ncig hloov pauv siv ConfigMap cov ntaub ntawv.
  3. Configure tag nrho cov key-value khub hauv a ConfigMap raws li lub thawv ib puag ncig hloov pauv.
  4. Siv ConfigMap -txhais ib puag ncig hloov pauv hauv Pod commands.
  5. Ntxiv ConfigMap cov ntaub ntawv mus rau ib qho Volume.
  6. Kev nkag siab ConfigMaps thiab Pods.

Kuj kom paub yog, ConfigMap yog dab tsi hauv Kubernetes?

ConfigMaps yog Kubernetes cov khoom uas tuaj yeem kos cov ntaub ntawv teeb tsa los ntawm lwm qhov chaw xws li cov npe lossis cov ntaub ntawv. ConfigMaps tau ntxiv rau cov npe virtual hu ua Volumes, uas yog cov ntaub ntawv txuas nrog uas qhia txog lub neej ntawm lub Pod uas kaw nws.

Kuj Paub, daim ntawv qhia config yog dab tsi? ConfigMaps khi cov ntaub ntawv teeb tsa, cov lus hais sib cav, ib puag ncig hloov pauv, tus lej chaw nres nkoj, thiab lwm yam khoom siv teeb tsa rau koj lub Pods cov thawv thiab cov khoom siv hauv lub sijhawm ua haujlwm. ConfigMaps muaj txiaj ntsig zoo rau kev khaws cia thiab sib qhia cov ntaub ntawv tsis tseem ceeb, tsis muaj kev sib txuas lus.

Ntawm no, kuv yuav hloov kho ConfigMap hauv Kubernetes li cas?

Tsuas yog pov: kubectl kho configmap < npe configmap > ntawm koj kab lus. Ces koj ua tau kho koj configuration. Qhov no opens vim tus kws kho mob nrog lub configmap hauv yaml format. Tam sim no yooj yim kho nws thiab txuag nws.

Kuv yuav teeb tsa ib puag ncig hloov pauv hauv Kubernetes li cas?

Thaum koj tsim Pod, koj tuaj yeem ua tau teem ib puag ncig variables rau cov thawv uas khiav hauv Pod. Rau teem ib puag ncig variables , suav nrog env lossis envFrom teb hauv cov ntaub ntawv teeb tsa. Hauv koj lub plhaub, khiav cov lus txib printenv los sau cov ib puag ncig hloov pauv . Txhawm rau tawm ntawm lub plhaub, nkag mus tawm.

Pom zoo: