Skip to content

Instantly share code, notes, and snippets.

@joshy91
Created July 13, 2018 08:19
Show Gist options
  • Save joshy91/ee5fca0edccdca0fd43c18f1dfe2f8c5 to your computer and use it in GitHub Desktop.
Save joshy91/ee5fca0edccdca0fd43c18f1dfe2f8c5 to your computer and use it in GitHub Desktop.
#!/bin/bash
#Self Healing
#Nginx deployment yaml created in previous script
kubectl create -f nginx-deployment.yaml
#Check status of pods; including replicas
kubectl get pods
#Delete indicated pod within nginx deployment
kubectl delete pod nginx-deployment-6fdbb596db-2gjdp
#Check status of pods; including replicas (new pod replaces deleted pod)
kubectl get pods
#Display node where the indicated pod is present
kubectl describe pod nginx-deployment-6fdbb596db-hr5xb | grep Node
#The node indicated in the above line was turned off
#Check status of nginx deployment
kubectl get deployments
#Check status of pods
kubectl get pods
#Check status of pod
kubectl describe pod nginx-deployment-6fdbb596db-hr5xb
#After 5 mins the status of the pod with the turned off node is changed to unknown
#A new pod is created to maintain 3 replicas
#Once the node is turned back on the unknown status pod is removed and replaced by the new pod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment