亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

備戰CKA每日一題——第13天 | 真題靜態Pod創建方法,Pod域名解析考試真題

標簽:
Kubernetes

昨日考题

Set configuration context $ kubectl config use-context wk8s

configure the kubelet systemed managed service, on the node labelled with name=wk8s-node-1,to launch a pod containing a single container of image nginx named myservice automatically.

Any spec file requried should be placed in the /etc/kuberneteds/mainfests directory on the node

Hints:

You can ssh to the failed node using $ ssh wk8s-node-0

You can assume elevated privileges on the node with the following command $ sudo -i

请给出操作步骤。

昨日答案

切换至wk8s上下文:

kubectl config use-context wk8s

查看有labelname=wk8s-node-1的node的信息

kubectl get nodes -l name=wk8s-node-1 -o wide

登录指定的机器,并获得操作权限。

ssh wk8s-node-0
sudo -i

查看kubelet服务启动参数–config

systemctl status kubelet -l

在–config指定的文件中,找到staticPodPath文件目录

# cat /var/lib/kubelet/config.yaml|grep staticPodPath
staticPodPath: /etc/kubernetes/manifests

在静态pod目录下创建yaml,使用下面命令生成符合要求的myservice.yaml,等待kubelet自动拉起静态pod

kubectl run myservice --image=nginx --generator=run-pod/v1 --dry-run -o yaml > myservice.yaml

昨日解析

本题主要考kubelet的配置,以及Static Pod的创建。

可以通过systemctl status kubelet -l查看kubelet进程的配置文件路径。
在这里插入图片描述
以及通过配置文件config.yaml找到staticPodPath
在这里插入图片描述
有时候,情况可能会不一样,systemctl status kubelet -l查到的10-kubeadm.conf中没有config.yaml配置:
在这里插入图片描述
而是将其直接用--pod-manifest-path传入,所以这种情况就需要修改10-kubeadm.conf中的配置路径(如果路径不是期望路径)

--pod-manifest-path=/etc/kubernetes/manifests

修改后需要重启kubelet:

systemctl start kubelet

今日考题

Set configuration context $ kubectl config use-context k8s;

Create a deployment as follows;

Name: nginx-dns;

Exposed via a service: nginx-dns;

Ensure that the service & pod are accessible via their respective DNS records;

The container(s) within any pod(s) running as a part of this deployment should use the nginx image;

Next,use the utiliity nslookup to look up the DNS records of the service & pod and write the output to /opt/service.dns and /opt/pod.dns respectively;

Ensure you use the busybox:1.28 image (or earliser) for any testing, an the latest release has an unpstream bug which impacts the use of nslookup;

作者简介

作者:小碗汤,一位热爱、认真写作的小伙,目前维护原创公众号:『我的小碗汤』,专注于写linux、golang、docker、kubernetes等知识等提升硬实力的文章,期待你的关注。转载说明:务必注明来源(注明:来源于公众号:我的小碗汤, 作者:小碗汤)

作者简洁

作者:小碗汤,一位热爱、认真写作的小伙,目前维护原创公众号:『我的小碗汤』,专注于写go语言、docker、kubernetes、java等开发、运维知识等提升硬实力的文章,期待你的关注。转载说明:务必注明来源(注明:来源于公众号:我的小碗汤,作者:小碗汤)

點擊查看更多內容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
JAVA開發工程師
手記
粉絲
5
獲贊與收藏
25

關注作者,訂閱最新文章

閱讀免費教程

  • 推薦
  • 評論
  • 收藏
  • 共同學習,寫下你的評論
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消