Set 1 Flashcards
Shorthand to create a service for a resource
kubectl expose
Flag to set name in kubectl expose
–name
Flag to set port in kubectl expose
–port
Flag to set target-port in kubectl expose
–target-port
Which flag is used to create a configMap from file
–from-file
which flag is likely used when using shorthand for a secret
–from-literal
Grep flag for 5 lines before match
-B 5
Grep flag for 8 lines after match
-A 8
Build image with a tag for registry.killer.sh:5000/sun-cipher
Docker build -t registry.killer.sh:5000/sun-cipher:TAGVALUE
podman build -t registry.killer.sh:5000/sun-cipher:TAGVALUE
What are the 3 recommended exam start procedures
- alias k=kubectl
- export do=”–dry-run=client -o yaml”
- export now=”–force –grace-period 0”
Navigate to container spec for a deployment and what else would occur in these levels?
root (metadata) -> spec (replicas) -> template (metadata) -> pod spec (volumes) -> containers (volumeMounts)
spec.template.spec.containers
Build a temp pod to run a command
kubectl run tmp –restart=Never –rm –image=nginx:alpine -i – <command></command>
Explain the steps required to build a functional persistent volume
build the following: PersistentVolume, PersistentVolumeClaim, Pod
pod.yaml:
fill spec.volumes:
- name
- persistentVolumeClaim: with claimName
fill spec.containers.volumeMounts:
- mountPath
- name
Where do you control PVC access control?
PV.yaml:
metadata.annotations:
spec to make job execute 3 times
spec.completions: 3
spec to make job execute in pairs of 2
spec.parallelism: 3
T or F: jobs have a spec.template just like a deployment
T
How do you mount a secret to a pod?
spec.containers.volumeMounts:
set name, mountPath and readOnly
spec.volumes:
set name,
secret:
set secretName and optional
shorthand to create ConfigMap called indexer: fill it with a file index.html under the key, web.
kubectl create configmap indexer –from-file web=index.html
How do you mount a ConfigMap to a pod, with a specific value?
spec.containers.volumeMounts:
set name and mountPath
spec.volumes:
set name,
configMap:
set name,
items:
set key and path
how would you write a pod command in its yaml manifest?
[‘sh’, ‘-c’, ‘<command></command>’] or [‘bash’, ‘-c’, ‘<command></command>’]
change namespace context to dev
kubectl config set-context –current –namespace=dev
difference between StatefulSet vs. DaemonSet vs. Deployment
StatefulSets run one or more pods with a persistent ID and persistent volumes, which is suitable for running stateful applications.
DaemonSets run one or more pods across the entire cluster or a certain set of nodes. This can be used to run administrative workloads such as logging and monitoring components.
Deployments run one or more pods, allowing you to define how many replicas of the pods need to run, on which types of nodes, and which deployment strategy should be used (for example, a Rolling deployment which replaces pods with a new version one by one, to prevent downtime).