Kuberneties_for_beginners

Hey All,

Need help please :pray: with the creation of the voting-app on Kubernetes.
When I try to create the Pod β†’ using the worker-app-deployment.yaml
The Pod creation is in CrashLoopBackOff
The logs are:
System.AggregateException: One or more errors occurred. (No such device or address) β€”> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: No such device or address
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.ResolveCallback(Object context)
β€” End of stack trace from previous location where exception was thrown β€”
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)
at System.Net.Dns.<>c.b__25_1(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)
β€” End of inner exception stack trace β€”
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Npgsql.NpgsqlConnector.Connect(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout)
at Npgsql.ConnectorPool.Allocate(NpgsqlConnection conn, NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnection.OpenInternal()

I try to search for a similar problem and I found that this is reported before, and I even change the version of Postgres to be 9.4
After that, I was even able to connect to the Pod and to the Postgres CLI with the username and password that I supply in the Yaml file.

Thanks in advance!

Hi Dear,

Thanks for sharing advice.

Also you can follow these full steps to know what you have missed and try again :

Note: We will create deployments again so please before following the steps, Run kubectl delete deployment --all to delete old deployments and avoid any conflicts.

  1. Run git clone https://github.com/mmumshad/example-voting-app-kubernetes-v2.git

  2. Run cd example-voting-app-kubernetes-v2/

  3. Run vim postgres-deployment.yml and modify it’s content as below then save and exit.

Note: It’s a new update from Postgres.

apiVersion: apps/v1 kind: Deployment metadata: name: postgres-deployment labels: app: demo-voting-app spec: replicas: 1 selector: matchLabels: name: postgres-pod app: demo-voting-app template: metadata: name: postgres-pod labels: name: postgres-pod app: demo-voting-app spec: containers: - name: postgres image: postgres:9.4 env: - name: POSTGRES_USER value: postgres - name: POSTGRES_PASSWORD value: postgres - name: POSTGRES_HOST_AUTH_METHOD value: trust ports: - containerPort: 5432

  1. Run kubectl create -f . if you create deployments for the first time, if you created the same deployments before Run kubectl apply -f . .

  2. Run kubectl get service to get the exposed ports.

For example if the output of the command as above you can accces the voting app by hitting One_of_the_worker_nodes_IP:32733 on your browser and the same for the resulting app >> One_of_the_worker_nodes_IP:30013.

Check :

Note: The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client.

Hope this helps!

Thanks,
Working now!

Great!
Happy learning.