Dealing with Bad Releases
Learn how we can manually and automatically prevent bad releases.
We'll cover the following...
Deployments also allow us to mitigate the risk of a bad release either by letting us manually rollback this release or by automatically preventing this release from happening.
Let’s test that out by creating a new version that simulates an issue. Here’s the updated code for our app:
Manually blocking the bad release
Press + to interact
require "sinatra"set :bind, "0.0.0.0"$counter = 0get "*" do$counter += 1if $counter > 3raise "Whoops, something is wrong"end"[buggy] Hello, Kubernetes!\n"end
After three successful responses, the app crashes with an exception. This allows us to simulate a case where the app starts running correctly but after some time it starts failing. We’ve pushed this buggy image to Docker Hub by using the following commands:
Press + to interact
docker build . -t brianstorti/hellok8s:buggydocker push brianstorti/hellok8s:buggy
Let’s update the manifest to start using this new image.
Press + to interact
apiVersion: apps/v1kind: Deploymentmetadata:name: hellok8sspec:replicas: 2selector:matchLabels:app: hellok8stemplate:metadata:labels:app: hellok8sspec:containers:- image: brianstorti/hellok8s:buggyname: hellok8s-container
We can apply this manifest using the following command to see the rolling ...
Access this course and 1400+ top-rated courses and projects.