Can change clusterip to nodeport command line without editor?

Multi tool use
Multi tool use


Can change clusterip to nodeport command line without editor?



NodePort
This way of accessing Dashboard is only recommended for development environments in a single node setup.



Edit kubernetes-dashboard service.



$ kubectl -n kube-system edit service kubernetes-dashboard
You should see yaml representation of the service. Change type: ClusterIP to type: NodePort and save file.



Can change clusterip to nodeport command line without editor?
Thanks!




2 Answers
2



You can just fetch the YAML for this given service:


kubectl -n kube-system get service kubernetes-dashboard -o yaml > kube-dash-svc.yaml



Make the changes you want (without using an editor).
e.g.,


sed 's/ClusterIP/NodePort/' kube-dash-svc.yaml > new-kube-dash-svc.yaml



Delete the current service:


kubectl delete svc kubernetes-dashboard



And finally feed this yaml back to the Kubernetes control plane:


kubectl create -f new-kube-dash-svc.yaml





kubectl delete svc kubernetes-dashboard --namespace kube-system
– Anton Patsev
Jun 30 at 12:51





oops. Yeah, that's right :)
– theMarceloR
Jun 30 at 17:17



you can change it like this


kubectl patch svc kubernetes-dashboard --type='json' -p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]'






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

LY1t8xRd r0
HEh3zhyo3LLGbnm9rn8Tt0RprQ,6

Popular posts from this blog

Delphi Android file open failure with API 26

.

Amasya