在 kubernetes 1.29.x 集群中。首先确保命名空间包含 configmap:
➜ migration kubectl get configmaps -n reddwarf-cache
NAME DATA AGE
cruise-redis-configuration 3 2y334d
cruise-redis-health 6 2y334d
cruise-redis-scripts 2 2y334d
kube-root-ca.crt 1 2y334d
reddwarf-redis-configuration 3 451d
reddwarf-redis-health 6 451d
reddwarf-redis-scripts 2 451d
当我尝试使用此命令获取 kubernets configmap 时:
➜ migration kubectl get configmaps -o yaml -n reddwarf-cache- > reddwarf-cache-configmap.yaml
➜ migration cat reddwarf-cache-configmap.yaml
apiVersion: v1
items: []
kind: List
metadata:
resourceVersion: ""
selfLink: ""
configmap 为空,我确定我可以访问 configmap,为什么无法从 kubernetes 集群获取 configmap yaml 配置?我也尝试过:
kubectl get cm -o yaml -n reddwarf-cache- > reddwarf-cache-configmap.yaml