k8s deployment 样本

#注意以下样本没有health check ,监测到容器无法提供服务了就暴力重启 -> https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/

---
kind: Deployment
apiVersion: apps/v1beta1
metadata:
  name: ner-rpc
  namespace: zzyy
spec:
  replicas: 2
  selector:
    matchLabels:
      nlp: zzyy.Deployment.ner_rpc
  template:
    metadata:
      creationTimestamp: null
      labels:
        nlp: zzyy.Deployment.ner_rpc
    spec:
      volumes:
      - name: ner-log
        hostPath:
          path: /data/duser/chengdushisuo/test/data/log/ner
      - name: ner-user-dict
        hostPath:
          path: /data/duser/chengdushisuo/test/data/dict/ner/user_dict.txt
          type: "FileOrCreate"
      imagePullSecrets:
      - name: mysecret
      containers:
      - name: ner-rpc
        image: dockerhub.datagrand.com/chengdushisuo/ner_rpc:http_v1
        ports:
        - containerPort: 9400
        env:
        - name: PROCESS_NUM
          value: '1'
        - name: ner_rpc_port
          value: '9400'
        volumeMounts:
        - name: ner-log
          mountPath: /data/duser/nlp/log
        - name: ner-user-dict
          mountPath: /data/duser/nlp/data/user_dict.txt
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      #nodeSelector:
        #jzyq-prod: 'True'
      securityContext:
        seLinuxOptions: {}
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 2
  progressDeadlineSeconds: 600

 

你可能感兴趣的:(k8s deployment 样本)