k8s::deployment

deployment 管理 Pod

1.0 deployment 创建 Pod

/* 在test1命名空间中生成一个 deployment ,并运行ingex */
kubectl create deployment deploy-nginx -n test1 --image=ingex
/* 在test1命名空间删除deployment */
kubectl delete deployment deoloy-nginx -n test1
/* 在test1查看deployment */
kubectl get deployment -n test1

打开图形化界面,可以伸缩配置pod个数,如果pod删除,可自动生成并维护pod数量。

image

1.1 通过yml创建 Pod
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: test1
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3	/* 集群数3 */
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
posted @ 2020-11-04 23:18  osbreak  阅读(267)  评论(0编辑  收藏  举报