月度归档:2021年05月

K8s启动命令

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: ccc.cccc.cn 
  labels:
    app: web-api
spec:
  replicas: 3
  template:
    metadata:
      labels:
        app: api
    spec:
      restartPolicy: "Always"
      containers:
      - name: api-cccc-cn
        image: api:39
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/sh","-c"," /usr/local/bin/composer dump-autoload ; crontab -e -u www-data ; crond ; /usr/bin/supervisord "]
        resources:
          limits:
            cpu: "1500m"
            memory: "1000Mi"
          requests:
            cpu: "200m"
            memory: "200Mi"
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        - containerPort: 443
          name: https
          protocol: TCP
        - containerPort: 9913
          name: nginx-vts
          protocol: TCP
        - containerPort: 9190
          name: php-fpm-export
          protocol: TCP
        - containerPort: 42323
          #hostPort: 42323
          name: php
          protocol: TCP
        - containerPort: 8080
          name: tcp-8080
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          periodSeconds: 5
          successThreshold: 1
          tcpSocket:
            port: 443
        volumeMounts:
        - name: nginx-configmap
          mountPath: /etc/nginx/conf.d
        - name: nginx-configmap-consul
          mountPath: /etc/nginx/sites-enabled
        - name: nginxcert-configmap
          mountPath: /var/www/cert
        - name: api-nginx-log
        #- name: nfs-pvc
          mountPath: /var/log/nginx/
        - name: nfs-php-logs
          mountPath: /var/www/html/k8s/storage/logs/
        - name: api-php-uploads
          mountPath: /var/www/html/k8s/public/uploads
        - name: api-php-vendor
          mountPath: /var/www/html/k8s/vendor/
      imagePullSecrets:
      - name: registry-secret-new
      volumes:
      - name: nginx-configmap
        configMap:
          name: nginxconf-api
      - name: nginx-configmap-consul
        configMap:
          name: nginxconf-consul.cccc.cn
      - name: nginxcert-configmap
        configMap:
          name: nginxcert-cccc.cn
      - name: api-nginx-log
      #- name: nfs-pvc
        hostPath:
      # persistentVolumeClaim:
          path: /data/logs/api-nginx
         # claimName: product-claim-api
      - name: nfs-php-logs
        persistentVolumeClaim:
          claimName: product-claim-api-php-logs
      - name: api-php-uploads
        persistentVolumeClaim:
          claimName: product-claim-api-upload
      - name: api-php-vendor
        persistentVolumeClaim:
          claimName: product-claim-api-vendor