Modify the service port number
View all services kubectl get service
Modify the service file: kubectl edit svc [service name]
[root@zjj101 ~]# kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 42h
nginx-service NodePort 10.105.185.220 <none> 8888:31111/TCP 8m12s
[root@zjj101 ~]# kubectl edit svc nginx-service
After modifying, press esc :wq to save
The console appears: service/nginx-service edited indicating that the save was successful
Check again
[root@zjj101 ~]# kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 42h
nginx-service NodePort 10.105.185.220 <none> 8888:31112/TCP 10m
Issuing PORT has been changed to 31112
access:
http://zjj101:31112/
Found that it can be accessed normally, the release has been changed successfully at this time