惜风不起、唯有努力!
k8s deployment demo

k8s deployment demo

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-dep
  namespace: web
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      #NodeName: 122-node008
      terminationGracePeriodSeconds: 35
      serviceAccountName: web-nginx-sa
      containers:
      - name: nginx-images
        image: nginx
        imagePullPolicy: IfNotPresent
        env:
        - name: DEMO_GREETING
          value: "my-env"
        ports:
        - containerPort: 80
          name: app-port
          protocol: TCP
        resources:
          limits:
            cpu: 200m
            memory: 500Mi
          requests:
            cpu: 100m
            memory: 200Mi
        livenessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 15
          timeoutSeconds: 5
          failureThreshold: 3
          successThreshold: 1
        readinessProbe:
          tcpSocket:
            port: 80
          initialDelaySeconds: 15
          timeoutSeconds: 5
          failureThreshold: 3
          successThreshold: 1
        volumeMounts:
        - name: wwwroot
          mountPath: /usr/share/nginx/html
        - name: nginx-time
          mountPath: /etc/localtime
      volumes:
      - name: wwwroot
        persistentVolumeClaim:
          claimName: nginx-pvc
      - name: nginx-time
        hostPath:
          path: /etc/localtime

发表回复

您的电子邮箱地址不会被公开。