单独发布代码
应用容器主动拉取代码
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: dyland-lua-api-pre namespace: php spec: replicas: 1 selector: matchLabels: name: dyland-lua-api-pre envrion: php template: metadata: annotations: prometheus.io/scrape: "true" prometheus.io/port: "9913" prometheus.io/scheme: "http" prometheus.io/path: "/metrics" labels: name: dyland-lua-api-pre envrion: php version: "" spec: initContainers: - name: rsync-code image: hub.dz11.com/op-base/rsync:v3.1.3 command: - "sh" - "-c" - > /bin/echo '123456' > /home/www/server/rsync.pwd; chmod 400 /home/www/server/rsync.pwd; /usr/bin/rsync -avzLu --password-file=/home/www/server/rsync.pwd www@$(RSYNC_SERVER)::pre-lua/dyland-lua-api.pre.wh03 /home/www/server/ > /dev/stdout 2>&1; env: - name: RSYNC_SERVER value: 192.168.1.10 volumeMounts: - name: www-root mountPath: "/hommee/www/server" containers: - name: dyland-lua-api-pre image: hub.dz11.com/op-base/openresty:1.11.2.4 imagePullPolicy: Always lifecycle: postStart: exec: command: - "sh" - "-c" - > /bin/echo 'options single-request-reopen' >> /etc/resolv.conf; ports: - containerPort: 80 env: - name: APP_NAME value: dyland-lua-api.pre.wh03 volumeMounts: - name: nginx-conf mountPath: /usr/local/ngx_openresty/nginx/conf/vhost - name: applogdir mountPath: /home/www/logs/applogs - name: srvlogdir mountPath: /home/www/logs/srvlogs - name: www-root mountPath: /home/www/server # mountPath: /home/www/server/dyland-lua-api.pre.wh03 - name: nginx-vts-exporter image: hub.dz11.com/library/nginx-vts-exporter:v0.10.3 ports: - containerPort: 9913 env: - name: NGINX_HOST value: "http://localhost/status/format/json" volumes: - name: nginx-conf configMap: name: dyland-lua-api-pre-configmap - name: applogdir hostPath: path: /home/www/logs/applogs - name: srvlogdir hostPath: path: /home/www/logs/srvlogs - name: www-root emptyDir: {} # hostPath: # path: /home/www/server/dyland-lua-api.pre.wh03 imagePullSecrets: - name: dk-reg nodeSelector: testenv: pre