k8s快速生成一个deploymenet的yaml文件


kubectl create deployment nginx --image=nginx:1.20 -o yaml --dry-run=client > my-deployment.yaml

cat my-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx:1.20
        name: nginx
        resources: {}
status: {}

我们修改之后进行kubectl apply -f   my-deployment.yaml 生效

posted @ 2022-03-02 14:54  忙碌在路上  阅读(223)  评论(0编辑  收藏  举报