目录
# 容器初始化,nginx配置
apiVersion: "v1"
kind: "Pod"
metadata:
name: nginx-67
spec:
volumes:
- name: guazai
emptyDir: {}
initContainers:
- name: ches
image: nginx:alpine
imagePullPolicy: IfNotPresent
args: ["/bin/sh", "-c", "echo k8s >> /usr/share/nginx/html/index.html"]
volumeMounts:
- name: guazai
mountPath: /usr/share/nginx/html
containers:
- name: nginx-fw
image: nginx:alpine
imagePullPolicy: IfNotPresent
volumeMounts:
- name: guazai
mountPath: /usr/share/nginx/html
# 到容器启动的虚拟机下
[root@master-1 nginx]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-67 1/1 Running 0 38m 10.2.1.35 node-1 <none> <none>
[root@node-1 ~]# curl 10.2.1.35
k8s
标签:容器,name,guazai,初始化,share,nginx,html,usr
From: https://www.cnblogs.com/xiutai/p/17749242.html