A
A
Anton Bes2020-03-27 12:51:59
Kubernetes
Anton Bes, 2020-03-27 12:51:59

How to correctly describe the path to the value of the "NodePort" element?

How to change port value in NodePort element using kubectl?
All attempts to do this resulted in "The request is invalid"

spec:
  clusterIP: 10.97.75.167
  externalTrafficPolicy: Cluster
  ports:
  - nodePort: 32694

In the example below, to replace the Type value, I used
kubectl -n kubernetes-dashboard patch svc kubernetes-dashboard --type='json' -p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]'

Is it possible to change the port in the same way?
spec:
  clusterIP: 10.97.75.167
  externalTrafficPolicy: Cluster
  ports:
  - nodePort: 32694
    port: 443
    protocol: TCP
    targetPort: 8443
  selector:
    k8s-app: kubernetes-dashboard
  sessionAffinity: None
  type: NodePort

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Ratanov, 2020-03-30
@BSH_EYES

something like that

kubectl -n istio-system patch svc istio-ingressgateway --type='json' -p '[{"op": "replace", "path":"/spec/ports/0/nodePort", "value":33333}]'

took from here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question