Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
Lifecycle of a Pod
Kubernetes Pune Meetup #7
08-July-2017
About Me
Contents
Kubernetes Architecture recap
Introduction to Pod
Interaction with Pod
Birth of a Pod
Stages of a Pod’s lifecycle...
Recap : Kubernetes Architecture
Image Courtesy: https://blog.heptio.com/core-kubernetes-jazz-improv-over-orchestration-a79...
Introduction to Pod
Pod is the smallest schedulable unit in Kubernetes
Containers within a Pod share:
IP address space
Por...
Interaction with Pods
Kubectl create -f <POD Definition YAML>
Kubectl get pods
Kubectl describe pod <POD NAME>
Kubectl log...
Birth of a Pod
Image Courtesy: Joe Beda
https://blog.heptio.com/core-kubernetes-
jazz-improv-over-orchestration-
a7903ea92...
Phases of a Pod
Pending: Accepted by Kubernetes but container not created yet.
Running: Pod bound to a node, all container...
Probes
Probe is a diagnostic performed periodically by kubelet on a container. There are
three types of handlers which can...
Liveness and Readiness probes
livenessProbe: Indicates whether the Container is running. If the liveness probe
fails, the ...
Termination of a Pod
Handlers to Lifecycle events
apiVersion: v1
kind: Pod
metadata:
name: lifecycle-demo
spec:
containers:
- name: lifecycle-d...
Init Containers
Out of Beta since 1.6
Init containers allow some pre-actions to run before the actual container is started...
Init Containers Example
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
spec:
containers:
- name: my...
Init Containers Example (continued)
kind: Service
apiVersion: v1
metadata:
name: myservice
spec:
ports:
- protocol: TCP
po...
Lifecycle of a pod
Próxima SlideShare
Cargando en…5
×

Lifecycle of a pod

809 visualizaciones

Publicado el

Presentation from Pune Kubernetes Meetup of 08-July-2017

Publicado en: Tecnología
  • Sé el primero en comentar

Lifecycle of a pod

  1. 1. Lifecycle of a Pod Kubernetes Pune Meetup #7 08-July-2017
  2. 2. About Me
  3. 3. Contents Kubernetes Architecture recap Introduction to Pod Interaction with Pod Birth of a Pod Stages of a Pod’s lifecycle Probes
  4. 4. Recap : Kubernetes Architecture Image Courtesy: https://blog.heptio.com/core-kubernetes-jazz-improv-over-orchestration-a7903ea92ca kubeproxy kubeproxy
  5. 5. Introduction to Pod Pod is the smallest schedulable unit in Kubernetes Containers within a Pod share: IP address space Port space Mounted Volumes Containers within a Pod can communicate via Localhost IPC mechanism such as Semaphores or Shared Memory
  6. 6. Interaction with Pods Kubectl create -f <POD Definition YAML> Kubectl get pods Kubectl describe pod <POD NAME> Kubectl logs <POD NAME> Kubectl exec <POD NAME> -- <COMMAND> Kubectl top <POD NAME>
  7. 7. Birth of a Pod Image Courtesy: Joe Beda https://blog.heptio.com/core-kubernetes- jazz-improv-over-orchestration- a7903ea92ca
  8. 8. Phases of a Pod Pending: Accepted by Kubernetes but container not created yet. Running: Pod bound to a node, all containers created and at least one container is running/starting/restarting Succeeded: Container(s) exited with status 0 Failed: All containers exit and at least one exited with non-zero status. Unknown: State of Pod could not be determined due to communication issues with its node
  9. 9. Probes Probe is a diagnostic performed periodically by kubelet on a container. There are three types of handlers which can be used to probe containers: ExecAction: Executes specified command inside container. TCPSocketAction: Performs check against TCP socket. Returns success if port is open HTTPGetAction: Performs HTTP GET against specified port and path. Successful if 200 > status code > 400.
  10. 10. Liveness and Readiness probes livenessProbe: Indicates whether the Container is running. If the liveness probe fails, the kubelet kills the Container, and the Container is subjected to its restart policy. readinessProbe: Indicates whether the Container is ready to service requests. If the readiness probe fails, the endpoints controller removes the Pod’s IP address from the endpoints of all Services that match the Pod.
  11. 11. Termination of a Pod
  12. 12. Handlers to Lifecycle events apiVersion: v1 kind: Pod metadata: name: lifecycle-demo spec: containers: - name: lifecycle-demo-container image: nginx lifecycle: postStart: exec: command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"] preStop: exec: command: ["/usr/sbin/nginx","-s","quit"]
  13. 13. Init Containers Out of Beta since 1.6 Init containers allow some pre-actions to run before the actual container is started. Init containers run to completion sequentially. Example Use Cases: Copy source code from a repo Generate config file for application (update pod specific variables etc) Check readiness of dependent services
  14. 14. Init Containers Example apiVersion: v1 kind: Pod metadata: name: myapp-pod labels: app: myapp spec: containers: - name: myapp-container image: busybox command: ['sh', '-c', 'echo The app is running! && sleep 3600'] initContainers: - name: init-myservice image: busybox command: ['sh', '-c', 'until nslookup myservice; do echo waiting for myservice; sleep 2; done;'] - name: init-mydb image: busybox command: ['sh', '-c', 'until nslookup mydb; do echo waiting for mydb; sleep 2; done;']
  15. 15. Init Containers Example (continued) kind: Service apiVersion: v1 metadata: name: myservice spec: ports: - protocol: TCP port: 80 targetPort: 9376 --- kind: Service apiVersion: v1 metadata: name: mydb spec: ports: - protocol: TCP port: 80 targetPort: 9377

×