1.

What are init containers?

Answer»

Generally, in Kubenetes, a pod can have many containers. Init container gets executed before any other containers RUN in the pod.

apiVersion: v1 kind: Pod metadata:   NAME: myapp-pod   labels:     app: myapp   annotations:     pod.beta.Kubernetes.io/init-containers: '[         {             "name": "init-myservice",             "image": "busybox",             "command": ["sh", "-c", "until nslookup myservice; do echo WAITING for myservice; sleep 2; done;"]         }     ]' spec:   containers:   - name: myapp-container     image: busybox     command: ['sh', '-c', 'echo The app is running! && sleep 3600']


Discussion

No Comment Found

Related InterviewSolutions