Application Lifecycle Management

Rolling updates and Rollbacks

Deployments trigger "rollouts", marking new "revisions"

kubectl rollout status deployment/myapp-deployment
kubectl rollout history deployment/myapp-deployment

Deployments rolling cause no downtime due to rolling strategy.

Modify yaml, then apply, causing new rollout and revision.

Upgrades in deployments create new replicaset and remove pods from old, add to new

Useful:

kubectl create -f deployment-definition.yaml
kubectl get deployments
kubectl apply -f deployment-definition.yaml
kubectl set image deployment/myapp-deployment nginx=nginx:1.9.1
kubectl rollout status deployment/myapp-deployment
kubectl rollout history deployment/myapp-deployment
kubectl rollout undo deployment/myapp-deployment

Commands and Arguments

Override commands and arguments via:

Environment Variables

Configmaps

Lets is define kv pairs

Imperative:

File:

ConfigMap:

Declarative:

Secrets

Same as ConfigMap, but encoded (NOT ENCRYPTED).

We encode as base64 in yaml:

Secret:

Just like configmap use envFrom:

Can use EncryptionConfiguration to encrypt secrets at rest (stall accessible by users with access to pods)

Encrypting

We can encrypt at rest in etcd

We can query etcd with etcdctl:

Encrypting Confidential Data at Rest

Check if --encryption-provider-config set in kube-apiserver:

(kubeadm):

Create EncryptionConfiguration (see docs), and pass via --encryption-provider-config

Init Containers

If you only wish to run something at initialization in a multi-container pod, use an initContainer, they work just like regular containers but exit.

initContainers must run to completion before the other container start. They run in sequential order.

Last updated