Kubernetes: What are init conatiners ?

0 votes
can somebody explain what are init containers in kubernetes context?
Jul 23 in Kubernetes by Liana
13 views

1 answer to this question.

0 votes

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']
answered Jul 23 by Sirajul
• 19,670 points

Related Questions In Kubernetes

0 votes
1 answer
0 votes
1 answer

What are selector based selectors in Kubernetes?

This type of selector allows filtering keys ...READ MORE

answered Apr 17 in Kubernetes by Kim
57 views
+2 votes
3 answers

Error while doing kubernetes-init command

The reason that it mentions the port ...READ MORE

answered Sep 6, 2018 in Kubernetes by Kalgi
• 39,330 points
2,300 views
0 votes
1 answer

What is unknown user client in kubernetes?

I think your Legacy Authorisation has been ...READ MORE

answered Sep 12, 2018 in Kubernetes by DareDev
• 6,810 points
44 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
1,676 views
+3 votes
1 answer
0 votes
1 answer

What are the container hooks available in kubernetes?

The hooks enable Containers to be aware ...READ MORE

answered Jul 15 in Kubernetes by Sirajul
• 19,670 points
20 views
0 votes
1 answer

Kubernetes: What are the types of multi-container pod patterns?

Here are the different types of multi-container ...READ MORE

answered Jul 17 in Kubernetes by Sirajul
• 19,670 points
17 views