k8s的InitContainer相关yaml
k8s中pod的生命周期与initcontainer测试Pod的yamlapiVersion: vikind: Podmetadata:name: myapp-podlabels:app: myappspec:containers:- name: myapp-containerimage: busyboxcommand: [...
·
k8s中pod的生命周期与initcontainer测试
Pod的yaml
apiVersion: vi
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: busybox
command: ['sh','-c','echo The app is running! && sleep 3600']
initContainers:
- name: init-myservice
image: busybox
command: ['sh','-c','until nslookup myservice; do echo waiting for myservice; sleep 2; done;']
- name: init-mydb
image busybox
command: ['sh','-c','until nslookup mydb; do echo waiting for mydb; sleep 2; done']
Svc的yaml
kind: Service
apiVersion: v1
metadata:
name: myservice
spec:
ports:
- protocol: TCP
port: 80
targetPort: 9376
---
kind: Service
apiVersion: v1
metadata:
name: mydb
spec:
ports:
- protocol: TCP
port: 80
targetPort: 9377
更多推荐
已为社区贡献1条内容
所有评论(0)