栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

kubectl pod 的增删改查

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

kubectl pod 的增删改查

kubectl pod 的增删改查
kubectl run 命令格式
Usage:
kubectl run NAME --image=image [–env=“key=value”] [–port=port]
[–dry-run=server|client] [–overrides=inline-json] [–command] – [COMMAND]
[args…] [options]

新增一个pod;
[root@centos7_1 ~]# kubectl run myweb --image=nginx
pod/myweb created

查看pod信息;
[root@centos7_1 ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
myweb 1/1 Running 0 20s
#显示pod的详细信息,包含ip,image,状况等
[root@centos7_1 ~]# kubectl describe pod myweb
Name: myweb
Namespace: default
Priority: 0
Node: 192.168.137.101/192.168.137.101
Start Time: Mon, 23 May 2022 14:28:46 +0800
Labels: run=myweb
Annotations:
Status: Running
IP: 172.20.1.5
IPs:
IP: 172.20.1.5
Containers:
myweb:
Container ID: docker://15bf0f694fcfa36c6073155affa26e262ebf310580b29239fb06213fca20a44e
Image: nginx
Image ID: docker-pullable://nginx@sha256:2d17cc4981bf1e22a87ef3b3dd20fbb72c3868738e3f307662eb40e2630d4320
Port:
Host Port:
State: Running
Started: Mon, 23 May 2022 14:29:05 +0800
Ready: True
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-fchhw (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-fchhw:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional:
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message


Normal Scheduled 71s default-scheduler Successfully assigned default/myweb to 192.168.137.101
Normal Pulling 69s kubelet Pulling image “nginx”
Normal Pulled 53s kubelet Successfully pulled image “nginx” in 16.633764145s
Normal Created 53s kubelet Created container myweb
Normal Started 52s kubelet Started container myweb

查看pod运行在那个node上;
[root@centos7_1 ~]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
myweb 1/1 Running 0 33s 172.20.1.5 192.168.137.101
删除pod;
[root@centos7_1 ~]# kubectl delete pod myweb
pod “myweb” deleted

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/927194.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号