Kubernetes Pod 相关命令

Kubernetes About 552 words

创建 Pod

  • --image:指定Pod的镜像
  • --port:指定端口
  • --namespace:指定namespace
kubectl run nginx --image=nginx:1.17.1 --port=80 --namespace dev

查看 Pod 基本信息

kubectl get pods -n dev

查看 Pod 详细信息

kubectl get pods -n dev -o wide

删除指定 Pod

kubectl delete pod nginx -n dev

yml 方式

编写 yml

命名为:pod-nginx.yml

apiVersion: v1
kind: Pod
metadata:
  name: nginx
  namespace: dev
spec:
  containers:
  - image: nginx:1.17.1
    name: pod
    ports:
    - name: nginx-port
      containerPort: 80
      protocol: TCP

创建

kubectl create -f pod-nginx.yml

删除

kubectl delete -f pod-nginx.yml
Views: 1,008 · Posted: 2022-03-09

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh