Configuration Flashcards
What is the ENTRYPOINT
statement of a Dockerfile?
Defines the command that is run at startup of the container
What is the CMD
statement of a Dockerfile
an array of parameters that are passed to the container as arguments at startup
What Dockerfile statement is equivalent to spec.containers[].command of a kubernetes Pod specification
spec.containers[].command
is equivalent to the ENTRYPOINT
statement in a Dockerfile
What Dockerfile statement is equivalent to spec.containers[].args of a kubernetes Pod specification
spec.containers[].args
is equivalent to the CMD
statement in a Dockerfile
In Pod spec.containers[], what parameter sets the environment variables
spec.containers[].env
is an array of name-value objects, e.g.:
spec: containers: - env: - name: FOO value: bar
What are three different ways of setting environment variables for a container in kubernetes
-
spec.containers[].env
property of Pod (or pod template in replicaset or deployment) - configmap
- secrets
How to reference a single environment variable value from a configmap in a Pod definition file
spec: containers: - env: - name: FOO valueFrom: configMapKeyRef: name: config-map-name key: config-map-key-name
How to reference an environment variable value from a secret within a Pod definition file
(e.g. a secret key with name my-secret)
spec: containers: - env: - name: FOO valueFrom: secretKeyRef: my-secret
How to reference an entire configmap as environment variables in a Pod definition file
spec: containers: - envFrom: - configMapRef: name: config-map-name
What is the apiVersion of a configmap?
v1
In a ConfigMap definition, how is a key created?
(e.g. a config map of name my-configmap
including a key with name foo
and valuebar
)
apiVersion: v1 kind: ConfigMap metadata: name: my-configmapdata: foo: bar
What is the imperative command for getting a list of ConfigMaps
kubectl get cm
What is the imperative command for viewing the contents of a ConfigMap cm1
kubectl describe cm cm1
What is the imperative command for viewing the contents of all ConfigMaps
kubectl describe cm
What is the purpose of a ConfigMap?
A ConfigMap is an API object used to store non-confidential data in key-value pairs.
What is the purpose of Secrets
Kubernetes Secrets let you store and manage sensitive information
What is the apiVersion of a Secret
v1
In a Secret specification, what are the four top-level keys?
apiVersion: v1kind: Secretmetadata: {}data: {}
What is the imperative command for creating a secret named FOO with sensitive data BAR
kubectl create secret mysecret1 --from-literal=FOO=$(echo BAR | base64)
How to encode a value BAR into a kubernetes secret
echo BAR | base64
How to decode a kubernetes secret
echo QkFSCg== | base64 -d
How to reference all values within a secret as environment variables within a Pod definition file
spec: containers: - envFrom: - secretRef: name: secret-name
In a Pod specification, spec.containers[], how do you run the container as user 1000?
spec: containers: - securityContext: runAsUser: 1000