我的pod规范文件
- name: temp1-cont
image: temp1-img:v2
env:
- name: CONFIG_MODE
value: "manager"
securityContext:
privileged: true
volumeMounts:
- mountPath: /bin/tipc-config
name: tipc-vol
volumeMounts:
- mountPath: /etc/
name: config-vol
resources:
limits:
cpu: 100m
memory: "100Mi"
requests:
cpu: 100m
memory: "100Mi"
command: ["/etc/init.d/docker-init"]
volumes:
- name: tipc-vol
hostPath:
path: /opt/tipc-config
type: FileOrCreate
- name: config-vol
hostPath:
path: /opt/config/
type: DirectoryOrCreate我使用两个hostPath卷,即tipc-vol和config-vol,但是当我创建pod时,只挂载了一个卷,顺便说一下,这是容器上挂载的最后一个卷
temp1-cont:
Container ID:
Image: temp1-img:v2
Image ID:
Port: <none>
Host Port: <none>
Command:
/etc/init.d/docker-init
State: Running
Started: Tue, 09 Jun 2020 09:36:57 +0000
Ready: False
Restart Count: 0
Limits:
cpu: 100m
memory: 100Mi
Requests:
cpu: 100m
memory: 100Mi
Environment:
CONFIG_MODE: manager
Mounts:
/etc/ from config-vol (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-g2ltz (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
tipc-vol:
Type: HostPath (bare host directory volume)
Path: /opt/tipc-config
HostPathType: FileOrCreate
config-vol:
Type: HostPath (bare host directory volume)
Path: /opt/config/
HostPathType: DirectoryOrCreate
default-token-g2ltz:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-g2ltz
Optional: false
QoS Class: Guaranteed在k8s文档中,没有提到这样的内容。我正在尝试测试我的应用程序,所以我使用的是hostVolume而不是持久卷。任何帮助都将不胜感激。提前谢谢。
发布于 2020-06-09 18:06:46
如下所示更新pod卷挂载
volumeMounts:
- mountPath: /bin/tipc-config
name: tipc-vol
- mountPath: /etc/
name: config-vol所以,你的pod yaml将会是
- name: temp1-cont
image: temp1-img:v2
env:
- name: CONFIG_MODE
value: "manager"
securityContext:
privileged: true
volumeMounts:
- mountPath: /bin/tipc-config
name: tipc-vol
- mountPath: /etc/
name: config-vol
resources:
limits:
cpu: 100m
memory: "100Mi"
requests:
cpu: 100m
memory: "100Mi"
command: ["/etc/init.d/docker-init"]
volumes:
- name: tipc-vol
hostPath:
path: /opt/tipc-config
type: FileOrCreate
- name: config-vol
hostPath:
path: /opt/config/
type: DirectoryOrCreate发布于 2020-06-09 18:08:15
卸下第二个volumeMounts:。所以下面应该是可行的
volumeMounts:
- mountPath: /bin/tipc-config
name: tipc-vol
- mountPath: /etc/
name: config-volhttps://stackoverflow.com/questions/62279762
复制相似问题