Application Lifecycle Management Flashcards
What is the command to see the rollout status?
k rollout status deployment/<deployment_name></deployment_name>
What is the command to see the revisions of the deployment
k rollout history deployment/<deployment_name></deployment_name>
What is the major disadvantage of the Recreate deployment strategy?
The application will be down for some amount of time
What does the Rolling Update Deployment Strategy do?
The new version is deployed in between taking down a previous version, ensuring the application is always up
What command updates a deployment after the manifest has been modified?
k apply -f <deployment_manifest>.yaml</deployment_manifest>
What is the imperative command to update the image for a deployment?
k set image deployment/<deployment_name> \ nginx=nginx:1.9.1</deployment_name>
What is the command to rollback a deployment?
k rollout undo deployment/<deployment_name></deployment_name>
How do define a command argument to an image in a manifest?
Add the args parameter under spec. eg.
spec:
containers:
- name: ubuntu-sleeper
image: ubuntu-sleeper
args: [“10”]
How do define a docker style entrypoint in a manifest?
Add the command parameter under spec. eg.
spec:
containers:
- name: ubuntu-sleeper
image: ubuntu-sleeper
command: [“sleep2.0”]
args: [“10”]
How do you set arguments when running a pod from an imperative command?
k run <name> --image=<image_name> -- <arg1> <arg2></arg2></arg1></image_name></name>
How do you set environment variables in a manifest?
Use the env parameter under the spec section. Environment variables should be in an array. eg.
spec:
containers:
…
env:
- name:
value:
What is the purpose of a config map?
Config maps are used to pass configuration data in the form of key value pairs in Kubernetes.
What is the imperative command to create a configmap?
k create configmap \
app-config – from-literal=APP_COLOR=blue
What is the imperative command to create a configmap from a file?
k create configmap \
<config-name> --from-file=<path-to-file></path-to-file></config-name>
How do you create a declarative configmap?
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
APP_COLOR: blue
APP_MODE: prod
What is the command to list configmaps?
k get configmaps
What is the command to describe a configmap?
k describe configmaps
How do you specify a configmap in a manifest?
Under the spec section in container definition, add an envFrom. eg.
spec:
What is the command to replace an existing pod from a file (generally done when editing is not allowed)?
k replace –force -f <filename>.yaml</filename>
How do you imperatively create a secret?
k create secret <secret_name> \
app-secret --from-literal=DB_Host=mysql</secret_name>
How do you imperatively create a secret and specify a file to read from?
k create secret <secret_name> \
app-secret --from-file=<name>.properties</name></secret_name>
What kind value denotes a secret?
Secret
What is the command to encode secrets in base64?
echo -n ‘<value>' | base64</value>
What is the command to decode secrets in base64?
echo -n ‘<value>' | base64 --decode</value>
How do specify a pod to use a secret in a manifest as an env variable?
spec:
containers:
…
:
- secretRef:
name: app-secret
How do specify a pod to use a secret in a manifest as a single env variable?
spec:
containers:
…
env:
- name: DB_Password
valueFrom:
secretKeyRef:
name: app-secret
key: DB_Password
How do you inject a secret as a file in a volume?
volumes:
- name: <app-secret-volume>
secret:
secretName: <app-secret></app-secret></app-secret-volume>
What happens when you use a secret with multiple variables in a volume?
A file for each secret will be injected into the volume
Are secrets encrypted?
No, they are only encoded
Are secrets encrypted in ETCD?
No, but you can encrypt at rest
Why is a container spec an array?
An array gives you the ability to add multiple containers to a manifest