Forum Navigation
You need to log in to create posts and topics.

Error: spec.ports[0].nodePort: Forbidden: may not be used when `type` is 'ClusterIP'

Problem 

User tries to change the type of the service from LoadBalancer to ClusterIP and getting the following error

The Service “kibana-kibana” is invalid: spec.ports[0].nodePort: Forbidden: may not be used when `type` is ‘ClusterIP’

Solution

Patch the service to NodePort

kubectl patch svc kibana-kibana -p ‘{“spec”: {“type”: “NodePort”}}’

and then patch to ClusterIP

kubectl patch svc kibana-kibana -p ‘{“spec”: {“type”: “ClusterIP”}}’

Note: if you still getting errors edit the service

kubectl edit svc kibana-kibana

Change this section from This

spec:
clusterIP: 10.100.144.140
externalTrafficPolicy: Cluster
ports:
– name: http
port: 5601
protocol: TCP
targetPort: 5601
selector:
app: kibana
release: kibana
sessionAffinity: None
type: CluserIP
status:
loadBalancer: {}

To This

spec:
clusterIP: 10.100.144.140
ports:
– name: http
port: 5601
protocol: TCP
targetPort: 5601
selector:
app: kibana
release: kibana
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

 

Uploaded files: