Demo Microservice application on GCP

Everything went ok until i create postgres on GCP it will create 1 but when I ran kubectl get pods… I am getting status CrashLoopBackoff and it keep restart.

I check my definition file postgres-pod.yml and is look ok see below
Screen Shot 2020-05-22 at 6.28.40 PM

and I have the same file in my git repository

I have delete the postgres-pod and create again same issue…

Do you think it has do something with version since when I go to dockerhub and check under tag The tag is 9.5

Please help- Thanks

I am not confirmed but i think you have to give user, password credentials through secrets.

I got the same issue. and i fixed it. try to add 'env: ’ variable to the postgres-pod.yml

env:
- name: POSTGRES_USER
value: “postgres”
- name: POSTGRES_PASSWORD
value: “postgres”

All pods and services are running

damithbandara92@cloudshell:~/sample-voting-app (my-first-project-279515)$ kubectl get pods
NAME READY STATUS RESTARTS AGE
postgres-pod 1/1 Running 0 94s
redis-pod 1/1 Running 0 2m2s
result-app-pod 1/1 Running 0 54s
voting-app-pod 1/1 Running 0 2m30s
worker-app-pod 1/1 Running 0 69s

damithbandara92@cloudshell:~/sample-voting-app (my-first-project-279515)$ kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
db ClusterIP 10.0.6.43 5432/TCP 86s
kubernetes ClusterIP 10.0.0.1 443/TCP 16h
redis ClusterIP 10.0.8.192 6379/TCP 113s
result-service LoadBalancer 10.0.4.184 35.238.239.193 80:31510/TCP 44s
voting-service LoadBalancer 10.0.14.196 34.71.241.132 80:31175/TCP 2m23s

But my application not give output. This is my app on git.

please help to fix this

okay wait, let me try for that

1 Like

it’s a Game of Pod voting app task?

I am able to access it. What you want to do? Database?

yes It’s Voting app. We can vote for Cat or dogs using voting-pod. and result out result-pod. All pods and services running. but result not view

Database not able to connect with that Pod as per logs.

1 Like

I tried this App with deployment too. same thing happen. see. services and pods are running.

damithbandara92@cloudshell:~/sample-voting-app/dep (my-first-project-279515)$ kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
db ClusterIP 10.0.6.18 5432/TCP 6m52s
kubernetes ClusterIP 10.0.0.1 443/TCP 43h
redis ClusterIP 10.0.0.12 6379/TCP 6m51s
result-service LoadBalancer 10.0.13.17 34.72.201.166 80:30575/TCP 6m51s
voting-service LoadBalancer 10.0.2.36 35.238.239.193 80:31346/TCP 6m51s

damithbandara92@cloudshell:~/sample-voting-app/dep (my-first-project-279515)$ kubectl get pods
NAME READY STATUS RESTARTS AGE
postgres-deployment-774dbfc9ff-jpm9v 1/1 Running 0 10m
redis-deployment-584f988495-sdmjc 1/1 Running 0 10m
result-app-deployment-bf659878-4bp54 1/1 Running 0 10m
voting-app-deployment-d6bd9cff9-r55dh 1/1 Running 0 10m
worker-deployment-d77546565-9rj2g 1/1 Running 0 8m43s

Voting also possible.

but result not comes out

ok. @player001 How can I fix that. what .yml file should i change or edit ?

dockersamples/examplevotingapp_result is this for sample?

1 Like

No. This is the one. https://github.com/mmumshad/kubernetes-example-voting-app.git

error in docker container(in docker image) that’s why not taking values.

You have to follow GameofPod docker image that one is correct. This one
kodekloud/examplevotingapp_vote:before

1 Like

Thank you @player001

Hi @player001 @Damith
I’m running into the same issue that @Damith ran into. I’m able to launch the voting app and the result app but the vote casted is not reflected on the result page. I changed the voting app docker image
to “kodekloud/examplevotingapp_vote:before” as mentioned above still I’m unable to get it working.
I believe the result app’s image should also be modified accordingly since kodekloud/examplevotingapp_vote:before" hosts voting for Bran Stark vs Jon Snow while the result app still shows Cats vs Dogs. I also referred to https://github.com/mmumshad/kubernetes-example-voting-app/blob/master/ for the pod definitions. Could you please point out the corrections and also get the stuff updated on the git repository. As such the files in the git hub repo doesn’t point to a fully functional app.