init 컨테이너(초깋화 컨테이너)

Untitled

사진처럼 initContainter가 2개가 존재하고 구조는 1번 init 컨테이너가 완료 후 2번 init 컨테이너 그 다음에 main컨테이너가 실행되는 순서를 갖고 있음

Untitled

클러스터: kubectl conk8s


  1. kbuectl config use-context conk8s
  2. vi /data/cka/webpod.yaml
  3. initcontainer(공홈) → EXamples →init containers in use에서 복사
initContainers:
  -name: init-myservice
   image: busybox:1.28
	 command: ['sh', '-c', "until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/            serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done"]
	 
수정
nitContainers:
  -name: init-myservice
   image: busybox:1.28
	 command: ['sh', '-c', 'touch /workdir/data.txt']

  1. container와 같은 라인와 붙여넣기

Untitled