CKA 無料問題集「Linux Foundation Certified Kubernetes Administrator (CKA) Program」
Create a busybox pod and add "sleep 3600" command
正解:
kubectl run busybox --image=busybox --restart=Never -- /bin/sh -c
"sleep 3600"
"sleep 3600"
Score: 13%
Task
A Kubernetes worker node, named wk8s-node-0 is in state NotReady. Investigate why this is the case, and perform any appropriate steps to bring the node to a Ready state, ensuring that any changes are made permanent.
Task
A Kubernetes worker node, named wk8s-node-0 is in state NotReady. Investigate why this is the case, and perform any appropriate steps to bring the node to a Ready state, ensuring that any changes are made permanent.
正解:
Solution:
sudo -i
systemctl status kubelet
systemctl start kubelet
systemctl enable kubelet
sudo -i
systemctl status kubelet
systemctl start kubelet
systemctl enable kubelet
Create a file:
/opt/KUCC00302/kucc00302.txt that lists all pods that implement service baz in namespace development.
The format of the file should be one pod name per line.
/opt/KUCC00302/kucc00302.txt that lists all pods that implement service baz in namespace development.
The format of the file should be one pod name per line.
正解:
solution
Print pod name and start time to "/opt/pod-status" file
正解:
kubect1 get pods -o=jsonpath='{range
.items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'
.items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'
Create a pod with image nginx called nginx and allow traffic on port 80
正解:
kubectl run nginx --image=nginx --restart=Never --port=80
Create a nginx pod with label env=test in engineering namespace
正解:
kubectl run nginx --image=nginx --restart=Never --labels=env=test --namespace=engineering --dry-run -o yaml > nginx-pod.yaml kubectl run nginx --image=nginx --restart=Never --labels=env=test --namespace=engineering --dry-run -o yaml | kubectl create -n engineering -f - YAML File:
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: engineering
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
restartPolicy: Never
kubectl create -f nginx-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: engineering
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
restartPolicy: Never
kubectl create -f nginx-pod.yaml