我正面临 Kubernetes 和 go 客户端组合的问题。命名空间中的主程序将使用go clientinvestigate
在命名空间下创建子 pod 。子 pod 期望挂载在 namespace 中可见的 configmap 。创建失败并出现错误:signer
signer
Warning FailedMount 25s (x3 over 27s) kubelet MountVolume.SetUp failed for volume "keyconfig" : object "signer"/"investigate-go-configmap-keyconf" not registered
Warning FailedMount 25s (x3 over 27s) kubelet MountVolume.SetUp failed for volume "kube-api-access-xhstz" : object "signer"/"kube-root-ca.crt" not registered
如果我也利用 configmapdebug
手动将 pod 添加到命名空间,则配置开始工作。signer
然后动态 pod 就可以成功挂载 configmap。区分这两种配置的唯一项目是debug
pod,其配置如下:
apiVersion: v1
kind: Pod
metadata:
name: debug
namespace: signer
spec:
serviceAccountName: signer
containers:
- name: debug
image: alpine:3.14.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: config-volume
mountPath: /etc/config
command:
- sh
- -c
- 'echo "Done"'
volumes:
- name: config-volume
configMap:
name: investigate-go-configmap-keyconf