Score: 4%
Task
Schedule a pod as follows:
• Name: nginx-kusc00401
• Image: nginx
• Node selector: disk=ssd
Solution:
Solution:
#yaml apiVersion: v1 kind: Pod metadata:
name: nginx-kusc00401 spec:
containers:
- name: nginx image: nginx
imagePullPolicy: IfNotPresent nodeSelector:
disk: spinning
#
kubectl create -f node-select.yaml
Does this meet the goal?
Correct Answer:
A
Configure the kubelet systemd- managed service, on the node labelled with name=wk8s-node-1, to launch a pod containing a single container of Image httpd named webtool automatically. Any spec files required should be placed in the /etc/kubernetes/manifests directory on the node.
You can ssh to the appropriate node using:
[student@node-1] $ ssh wk8s-node-1
You can assume elevated privileges on the node with the following command:
[student@wk8s-node-1] $ | sudo –i
Solution:
solution
F:WorkData Entry WorkData Entry20200827CKA21 C.JPG
F:WorkData Entry WorkData Entry20200827CKA21 D.JPG
F:WorkData Entry WorkData Entry20200827CKA21 E.JPG
F:WorkData Entry WorkData Entry20200827CKA21 F.JPG
F:WorkData Entry WorkData Entry20200827CKA21 G.JPG
Does this meet the goal?
Correct Answer:
A
Score: 7%
Task
Create a new nginx Ingress resource as follows:
• Name: ping
• Namespace: ing-internal
• Exposing service hi on path /hi using service port 5678
Solution:
Solution:
vi ingress.yaml
#
apiVersion: networking.k8s.io/v1 kind: Ingress
metadata: name: ping
namespace: ing-internal spec:
rules:
- http:
paths:
- path: /hi pathType: Prefix backend: service:
name: hi port:
number: 5678
#
kubectl create -f ingress.yaml
Does this meet the goal?
Correct Answer:
A
Create a pod with environment variables as var1=value1.Check the environment variable in pod
Solution:
kubectl run nginx --image=nginx --restart=Never --env=var1=value1
# then
kubectl exec -it nginx -- env
# or
kubectl exec -it nginx -- sh -c 'echo $var1'
# or
kubectl describe po nginx | grep value1
Does this meet the goal?
Correct Answer:
A
Check the Image version of nginx-dev pod using jsonpath
Solution:
kubect1 get po nginx-dev -o jsonpath='{.spec.containers[].image}{"n"}'
Does this meet the goal?
Correct Answer:
A