Practice
Pods
1 | kubectl create namespace -h |
ConfigMaps
Configure a Pod to Use a ConfigMap
Use
envFrom
to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod.
1 | kubectl create configmap -h |
Secrets
Using Secrets as environment variables
1 | kubectl create secret generic -h |
SecurityContext
Configure a Security Context for a Pod or Container
1 | kubectl explain Pod.spec.securityContext |
Resource Quotas
A resource quota, defined by a ResourceQuota object, provides constraints that limit aggregate resource consumption per namespace. It can limit the quantity of objects that can be created in a namespace by type, as well as the total amount of compute resources that may be consumed by resources in that namespace.
Resource Management for Pods and Containers
1 | kubectl create quota -h |
Service Accounts
Configure Service Accounts for Pods
1 | kubectl explain Pod.spec |
Readiness and Liveness Probes
Configure Liveness, Readiness and Startup Probes
Labels
Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported:
in
,notin
andexists
(only the key identifier).
1 | kubectl label -h |
Secrets
Using Secrets as files from a Pod
1 | kubectl create deployment -h |
Deployments
1 | kubectl set image -h |
CronJob
1 | kubectl create cronjob -h |
Service
Publishing Services (ServiceTypes)
1 | # --rm |
Network Policies
podSelector: Each NetworkPolicy includes a
podSelector
which selects the grouping of pods to which the policy applies. An emptypodSelector
selects all pods in the namespace.
Init Containers
Helm
1 | helm repo add stable https://charts.helm.sh/stable |
Exam Simulator
Question 1 | Namespaces
1 | kubectl get -h |
Question 3 | Job
1 | kubectl explain Job.spec.completions |
Question 4 | Helm Management
1 | helm list --namespace [NAMESPACE] |
Question 5 | ServiceAccount, Secret
1 | # base64 encoded token |
Question 11 | Working with Containers
1 | docker build -t NAME[:TAG] -t NAME[:TAG] . |
Question 13 | Storage, StorageClass, PVC
Question 19 | Service ClusterIP to NodePort
Question 20 | NetworkPolicy
1 | apiVersion: networking.k8s.io/v1 |
Notice that we specify two egress rules in the yaml above. If we specify multiple egress rules then these are connected using a logical OR.
Question 22 | Labels, Annotations
1 | kubectl label pods -l "KEY in (KEY_1,KEY_2)" KEY_3=VAL_3 ... KEY_N=VAL_N |