初始化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里面的全局目录

 

posted @ 2023-04-04 15:20  人生信条~~  阅读(15)  评论(0编辑  收藏  举报