Deployment资源清单文件详解

apiVersion: apps/v1
kind: Deployment 
metadata:
  name: portal
  namespace: ms 
spec:
  replicas: 1
  selector:
    matchLabels:
      project: ms
      app: portal
  template:
    metadata:
      labels:
        project: ms 
        app: portal
    spec:
      containers:
      - name: portal
        image:  xianchao/portal:v1  #镜像文件
        imagePullPolicy: Always  # 镜像拉取策略
        ports:
          - protocol: TCP
            containerPort: 8080 
        resources:  #资源配额
          limits:  #资源限制,最多可用的cpu和内存
            cpu: 1
            memory: 1Gi
         requests: #最少需要多少资源才可以运行Pod
            cpu: 0.5
            memory: 1Gi
        readinessProbe:
          tcpSocket:  # 就绪性探测
            port: 8080   #使用httpGet
          initialDelaySeconds: 60 #检测时间
          periodSeconds: 10
        livenessProbe:  #存活性探测
          tcpSocket: #使用httpGet
            port: 8080
          initialDelaySeconds: 60
          periodSeconds: 10

发表评论

后才能评论