初始化pod的
apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
volumes:
- name: workdir #全局的volumes
emptyDir: {}
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://www.baidu.com # https
volumeMounts:
- name: workdir
mountPath: "/work-dir" #容器里面的路径
containers:
- name: web
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir #挂载早全局的volumes
mountPath: /usr/share/nginx/html #容器里面的路径
emptyDir: {} 临时目录实际上数据保存在kubelet里面的全局目录