Kubernetes What are init conatiners

0 votes
can somebody explain what are init containers in kubernetes context?
Jul 23, 2019 in Kubernetes by Liana
391 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, 2019 by Sirajul
• 59,230 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, 2019 in Kubernetes by Kim
1,278 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
• 52,360 points
23,600 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,890 points
602 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17, 2019 in Others by anonymous
14,610 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,095 views
0 votes
1 answer

What are the container hooks available in kubernetes?

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

answered Jul 15, 2019 in Kubernetes by Sirajul
• 59,230 points
1,901 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, 2019 in Kubernetes by Sirajul
• 59,230 points
2,030 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP