Can not deploy container on gcloud

6/6/2019

I am trying to deploy the below container on gcloud:

https://hub.docker.com/r/anthonydahanne/spring-petclinic/

Then, I do below steps:

  1. I created a namespace on gcloud

    kubectl create ns qa

  2. I created a folder "clinic_tai" contains yaml files:

mysql-deployment.yaml mysql-service.yaml mysql-pvc.yaml petclinic-deployment.yaml petclinic-service.yaml

  1. I build these services

    kubectl --namespace=qa apply -f ~/spring-boot-docker/examples/kubernetes-1.10/clinic_tai/

  2. I get detail of services `kubectl --namespace=qa get services

    NAME                TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)          AGE
mysql               ClusterIP      10.47.254.97    <none>            3306/TCP         25m
petclinic-service   LoadBalancer   10.47.243.216   104.196.116.129   8081:31781/TCP   25m

But, I can't access the application by using the url: 104.196.116.129:8081

Please check my yaml files https://drive.google.com/open?id=1yLCwr8Lvm3fyxoGVc5DQpKFBdDq2CxZv

Do you know what's wrong ?

-- taibc
docker
google-kubernetes-engine
kubernetes

1 Answer

6/12/2019

Unfortunately I cannot access your yaml files but:

The problem can be in matching labels of the selectors in the pod.

If your pod has "app=egg" tag, but Service selector had "name=egg". Matching them fixed the access problem.

Just changed "name: egg" on the service selector, to "app: egg". If you set the matchLabels on deployment.

I hope it helps.

-- MaggieO
Source: StackOverflow