From dd13d275c589e21ac35b98fcb0022ef443030882 Mon Sep 17 00:00:00 2001 From: Arnaud Morin Date: Sun, 9 Jan 2022 00:05:16 +0100 Subject: [PATCH] up Signed-off-by: Arnaud Morin --- kubernetes/training/lessons/1-k8s101.md | 36 ++++++++++++++++++------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/kubernetes/training/lessons/1-k8s101.md b/kubernetes/training/lessons/1-k8s101.md index 6795d02..8b4c91a 100644 --- a/kubernetes/training/lessons/1-k8s101.md +++ b/kubernetes/training/lessons/1-k8s101.md @@ -182,7 +182,9 @@ kubectl set image deployments/first-dep kubernetes-bootcamp=jocatalin/kubernetes The command notified the Deployment to use a different image for your app and initiated a rolling update. Check the status of the new Pods, and view the old one terminating with the `get pods` command: -`kubectl get pods` +``` +kubectl get pods +``` Verify the update using curl @@ -198,28 +200,38 @@ kubectl rollout status deployments/first-dep To view the current image version of the app, run the `describe pods` command: -`kubectl describe pods` +``` +kubectl describe pods +``` In the `Image` field of the output, verify that you are running the latest image version (v2). ## Rollbacking the app Let’s perform another update, and deploy an image tagged with `v10` : -`kubectl set image deployments/first-dep kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10` +``` +kubectl set image deployments/first-dep kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10 +``` Use `get deployments` to see the status of the deployment: -`kubectl get deployments` +``` +kubectl get deployments +``` Notice that the output doesn't list the desired number of available Pods. Run the `get pods` command to list all Pods: -`kubectl get pods` +``` +kubectl get pods +``` Notice that some of the Pods have a status of `ImagePullBackOff`. To get more insight into the problem, run the `describe pods` command: -`kubectl describe pods` +``` +kubectl describe pods +``` In the `Events` section of the output for the affected Pods, notice that the `v10` image version did not exist in the repository. @@ -227,17 +239,23 @@ _Note: you can also use `kubectl get events` to retrieve the error._ To roll back the deployment to your last working version, use the `rollout undo` command: -`kubectl rollout undo deployments/first-dep` +``` +kubectl rollout undo deployments/first-dep +``` The `rollout undo` command reverts the deployment to the previous known state (v2 of the image). Updates are versioned and you can revert to any previously known state of a deployment. Use the `get pods` commands to list the Pods again: -`kubectl get pods` +``` +kubectl get pods +``` Four Pods are running. To check the image deployed on these Pods, use the `describe pods` command: -`kubectl describe pods` +``` +kubectl describe pods +``` The deployment is once again using a stable version of the app (v2). The rollback was successful.