Enabling automated updates

Once in a while (or more often) you need to update your application that’s running in a cloud-native fashion inside Kubernetes.

Let’s see how easy it is to do it with Keel.

Keel Quick Start

Install Keel

Installing Keel is the first step, as long as no update policies are defined in your application deployment files or Helm Charts, Keel will ignore them.
You can choose your preferred installation type (kubectl or Helm) to deploy Keel, more details are available here.

Specify update policy

Our example app is ‘webhook-demo’ which pretty much doesn’t do anything except registering incoming webhooks and showing them. Deployment file can be found here: https://github.com/webhookrelay/webhook-demo/blob/master/hack/deployment.yml.

While traditional deployment manifest would look like this:

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: wd
namespace: default
labels:
name: "wd"
spec:
replicas: 1
template:
metadata:
name: wd
labels:
app: wd
spec:
containers:
- image: karolisr/webhook-demo:0.0.8
imagePullPolicy: Always
name: wd
command: ["/bin/webhook-demo"]
ports:
- containerPort: 8090
livenessProbe:
httpGet:
path: /healthz
port: 8090
initialDelaySeconds: 30
timeoutSeconds: 10

We need to add Keel policy for updates and optional trigger type.

These settings have to be specified as labels:

keel.sh/policy: major
keel.sh/trigger: poll

Here:

Now, our deployment file looks like this:

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: wd
namespace: default
labels:
name: "wd"
keel.sh/policy: major
keel.sh/trigger: poll
annotations:
# keel.sh/pollSchedule: "@every 10m"
spec:
replicas: 1
template:
metadata:
name: wd
labels:
app: wd
spec:
containers:
- image: karolisr/webhook-demo:0.0.8
imagePullPolicy: Always
name: wd
command: ["/bin/webhook-demo"]
ports:
- containerPort: 8090
livenessProbe:
httpGet:
path: /healthz
port: 8090
initialDelaySeconds: 30
timeoutSeconds: 10
securityContext:
privileged: true

That’s it, we update our deployment with new labels, if you already have your app deployed:

kubectl apply -f your-app-deployment.yaml

And then wait for a few minutes till Keel picks up the changes.