创建Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment                #Deployment名称
  labels:
    app: nginx                          #Deployment标签定义
spec:
  replicas: 1                           #副本数
  selector:                             #标签选择器
    matchLabels:                        #匹配标签
      app: nginx                        #选择包含标签 app: nginx 的 Pod
  template:                             #Pod模板
    metadata:
      labels:
        app: nginx                      #Pod标签
    spec:
      containers:
      - name: nginx                     #容器名称
        image: xxx.com/nginx:1.20.1     #镜像名称和版本
        ports:
        - containerPort: 80             #指定容器的端口
      imagePullSecrets:                 #从harbor摘取镜像需要配置
        - name: harbor

 

posted @ 2024-03-21 10:48  吃吃吃大王  阅读(12)  评论(0)    收藏  举报