I used the below command to build my spring boot application for deployment in google cloud.
mvn clean install && docker build -t eu.gcr.io/XXX/demo .
gcloud builds submit --tag eu.gcr.io/XXX/demo
kubectl run demo-server --image eu.gcr.io/XXX/demo
kubectl expose deployment demo-server --type=LoadBalancer –port=8080
And I can access my application externally. I can delete and redeploy my application using:
kubectl delete deployment demo-server
kubectl run demo-server --image eu.gcr.io/XXX/demo
It is all working fine, but when I tried to expose the same application on different port say 8081, it failed to complain Error from server (AlreadyExists): services "demo-server" already exists
How can I change the service port?
I resolved it by
kubectl get services
kubectl delete services demo-server
I was deleting deployment but service was still available