简体   繁体   中英

Not able to expose deployment using kubernetes in google cloud

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM