Home > Software engineering >  Kubernetes kubectl view config
Kubernetes kubectl view config

Time:12-23

if i apply some config to kubernetes with kubectl like:

kubectl apply -f config.yaml

Is there any command to read or show this config? I need update some things in config, but I'm on another pc and I dont have configs here, so I need get them from kubectl first, is it possible? Thanks!

CodePudding user response:

  • simple way : cat the file
cat config.yaml
  • indirect way:
kubectl apply -f config.yaml --dry-run=client -o yaml
  • for brevity
kubectl create -f config.yaml --dry-run=client -o yaml

CodePudding user response:

You can copy ~/.kube/config from one machine to another, you can then access your cluster using kubectl on the other machine. From there you can do kubectl get configmap <name> -o yaml > config.yaml, edit the saved config.yaml and re-apply with kubectl apply -f config.yaml.

  • Related