Pod initContainers
1. Pod的初始化容器和应用程序容器共享一个Volume,
2. 进程间通信,一个pod包含多个container,如果有启动顺序,需要使用initcontainer init
3. nginx pod 反向代理 java服务,如果java没有启动,需要制定
apiVersion: apps/v1 kind: Deployment metadata: name: nginxedi namespace: senyint spec: selector: matchLabels: app: nginxedi replicas: 1 template: metadata: labels: app: nginxedi spec: containers: - name: nginxedi image: 172.16.230.29/senyint/nginxedi:20200407153739 resources: limits: cpu: 1000m memory: 4096Mi requests: cpu: 100m memory: 1024Mi ports: - containerPort: 80 name: httpport initContainers: - name: wait-hierestserver image: busybox command: ['sh', '-c', 'until nslookup hierestserver; do echo waiting for myservice; sleep 2; done;'] - name: wait-webadmin image: busybox command: ['sh', '-c', 'until nslookup webadmin; do echo waiting for myservice; sleep 2; done;'] - name: wait-oauthserver image: busybox command: ['sh', '-c', 'until nslookup oauthserver; do echo waiting for myservice; sleep 2; done;']