题干
For this question, please set this context (In exam, diff cluster name)
kubectl config use-context kubernetes-admin@kubernetes
Create a ReplicaSet named dns-rs-cka with 2 replicas in the dns-ns namespace using the image registry.k8s.io/e2e-test-images/jessie-dnsutils:1.3 and set the command to sleep 3600 with the container named dns-container .
Once the pods are up and running, run the nslookup kubernetes.default command from any one of the pod and save the output into a file named dns-output.txt .
创建一个名为dns-rs-cka
的副本集,在dns-ns命名空间中使用镜像注册表.k8 .io/e2e-test-images/jess -dnsutils:1.3
,并将命令设置为休眠3600,容器名为dns-container。
pod启动并运行后,在任何pod中运行nslookup kubernetes.default
命令,并将输出保存到名为dns-output.txt
的文件中。
解题思路
- 创建
dns-ns
命名空间,
kubectl create ns dns-ns
- 创建
dns-rs-cka
资源清单,内容如下:
apiVersion: apps/v1 kind: ReplicaSet metadata: name: dns-rs-cka namespace: dns-ns spec: replicas: 2 selector: matchLabels: app: dns-rs-cka template: metadata: labels: app: dns-rs-cka spec: containers: - name: dns-container image: registry.k8s.io/e2e-test-images/jessie-dnsutils:1.3 command: ["sleep", "3600"]
- 提交资源清单
kubectl apply -f dns-rs-cka.yaml
- 在任何pod中运行
nslookup kubernetes.default
命令,把输出结果保存到dns-output.txt
的文件中。
k -n dns-ns exec -it dns-rs-cka-fb7ffc69c-d2c2v -- nslookup kubernetes.default >dns-output.txt
题干
For this question, please set this context (In exam, diff cluster name)
kubectl config use-context kubernetes-admin@kubernetes
Create a Deployment named dns-deploy-cka with 2 replicas in the dns-ns namespace using the image registry.k8s.io/e2e-test-images/jessie-dnsutils:1.3 and set the command to sleep 3600 with the container named dns-container .
Once the pods are up and running, run the nslookup kubernetes.default command from any one of the pod and save the output into a file named dns-output.txt .
创建一个名为dns-deploy-cka
的部署,在dns-ns命名空间中使用镜像注册表.k8 .io/e2e-test-images/jess -dnsutils:1.3
,并将命令设置为使用名为dns-container
的容器休眠3600。
pod启动并运行后,在任何pod中运行nslookup kubernetes.default
命令,并将输出保存到名为dns-output.txt
的文件中。
解题思路
- 创建
dns-ns
命名空间,
kubectl create ns dns-ns
- 创建
dns-rs-cka
资源清单,内容如下:
apiVersion: apps/v1 kind: Deployment metadata: name: dns-deploy-cka namespace: dns-ns spec: replicas: 2 selector: matchLabels: app: dns-deploy-cka template: metadata: labels: app: dns-deploy-cka spec: containers: - name: dns-container image: registry.k8s.io/e2e-test-images/jessie-dnsutils:1.3 command: ["sleep", "3600"]
- 提交资源清单
kubectl apply -f dns-deploy-cka.yaml
- 在任何pod中运行
nslookup kubernetes.default
命令,把输出结果保存到dns-output.txt
的文件中。
k -n dns-ns exec -it dns-deploy-cka-fb7ffc69c-d2c2v -- nslookup kubernetes.default >dns-output.txt