K8s-deployment.yaml

来自三线的随记

example

常用示例

kind: Deployment
apiVersion: apps/v1
metadata:
  name: ubuntu-16-04
  namespace: default
  labels:
    dce.daocloud.io/app: ubuntu-1604
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: ubuntu-16-04
  template:
    metadata:
      creationTimestamp: null
      labels:
        dce.daocloud.io/app: ubuntu-1604
        k8s-app: ubuntu-16-04
    spec:
      containers:
        - name: ubuntu
          image: 'daocloud.io/library/ubuntu:16.04'
          resources:
            limits:
              cpu: '1'
              memory: 1Gi
          imagePullPolicy: IfNotPresent
          tty: true
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/hostname
                    operator: In
                    values:
                      - node-1
      tolerations:
        - operator: Exists
          effect: NoSchedule
  strategy:
    type: Recreate