0

In kubernetes 1.29.x cluster. Fisrt make sure the namespaces contains 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

When I tried to use this command to get the 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: ""

the configmap is null, I am sure I can access the config map, why could not get the configmap yaml config from the kubernetes cluster?I also tried:

kubectl get cm -o yaml -n reddwarf-cache- > reddwarf-cache-configmap.yaml
1
  • Your last two examples use -n reddwarf-cache- (note the trailing hypen). Is that a typo? Commented Jul 4 at 23:10

1 Answer 1

1

First, make sure you're specifying the correct namespace (reddwarf-cache) when retrieving the ConfigMap.  This command should work correctly:

kubectl get configmaps -o yaml -n reddwarf-cache > reddwarf-cache configmap.yaml

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .