ConfigMap yog dab tsi?
ConfigMap yog dab tsi?

Video: ConfigMap yog dab tsi?

Video: ConfigMap yog dab tsi?
Video: 26 - Использование ConfigMap и переменных окружения в Kubernetes 2024, Kaum ib hlis
Anonim

A ConfigMap yog ib phau ntawv txhais lus ntawm kev teeb tsa. Cov phau ntawv txhais lus no muaj cov ntsiab lus tseem ceeb ntawm cov hlua. Kubernetes muab cov txiaj ntsig no rau koj lub thawv. Zoo li nrog rau lwm cov phau ntawv txhais lus (daim duab qhia chaw, hashes,) tus yuam sij cia koj tau txais thiab teeb tsa tus nqi.

Ua li no, kuv yuav ua li cas thiaj tau ConfigMap hauv Kubernetes?

  1. Koj yuav tsum muaj Kubernetes pawg, thiab kubectl cov kab hais kom ua kab yuav tsum tau teeb tsa kom sib txuas lus nrog koj pawg.
  2. Siv kubectl tsim configmap hais kom ua los tsim ConfigMaps los ntawm cov npe, cov ntaub ntawv, lossis cov txiaj ntsig zoo:
  3. Koj tuaj yeem siv kubectl piav qhia lossis kubectl tau txais cov ntaub ntawv hais txog ConfigMap.

Kuj Paub, qhov txawv ntawm Kubernetes Cav config maps thiab secrets yog dab tsi? Qhov loj qhov sib txawv ntawm Secrets thiab ConfigMaps yog li ntawd zais cia ua obfuscated nrog a Base64 encoding. Tej zaum yuav muaj ntau dua sib txawv hauv cov yav tom ntej, tab sis nws yog kev xyaum zoo siv zais cia rau cov ntaub ntawv tsis pub lwm tus paub (xws li API yuam sij) thiab ConfigMaps rau cov ntaub ntawv tsis pub leej twg paub (xws li tus lej chaw nres nkoj).

Hauv qhov 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 editor nrog rau configmap hauv yaml format. Tam sim no yooj yim kho nws thiab txuag nws.

Yuav ua li cas kom tshem tau pod Kubernetes?

Ua ntej, paub meej lub npe ntawm qhov koj xav tau tshem tawm , thiab xyuas kom meej tias tag nrho cov pods ntawm node tuaj yeem raug txiav tawm yam tsis muaj cov txheej txheem tshwj xeeb. Tom ntej no, siv cov dej hais kom tshem tawm txhua tus neeg siv pods los ntawm node. Lawv yuav tau teem caij mus rau lwm qhov los ntawm lawv cov maub los (Deployment, ReplicaSet, thiab lwm yam).

Pom zoo: