Hello There,
I am doing Kubernetes for Absolute Beginners course and I am at the section to implement the Deploying of Voting App on Kubernetes.
I have set up the pods and services yaml files as described in the demo video. Everything works except for the worker pod, where I see the issue lies in Authentication issue (i guess).
Somehow the worker pod during ‘kubectl create -f worker-pod.yaml’ ends up with Back-off restarting failed container worker-app in pod worker-app-pod_default.
Since I am new to this, I don’t know what to do now… Can you please help? Let me know if you need any other info.
Thank you in advance.
Best,
Manoj
The first thing to figure out is why you get an error on the worker pod. So you want to look at the logs of a worker pod (kubectl logs NAME-OF-WORKER-POD
). What do you see?
Hey Rob,
Thanks for the response!
The logs I checked showed this. Looking at this I thought it may be related to authentication issue. But the result-app-pod, which also depends on the postgres-pod or db service, works properly, I mean it starts running without any issue. And so, I got stuck at this point.
System.NotSupportedException: Authentication method not supported (Received: 10)
at Npgsql.NpgsqlConnector.ParseServerMessage(ReadBuffer buf, BackendMessageCode code, Int32 len, DataRowLoadingMode dataRowLoadingMode, Boolean isPrependedMessage)
at Npgsql.NpgsqlConnector.DoReadMessage(DataRowLoadingMode dataRowLoadingMode, Boolean isPrependedMessage)
at Npgsql.NpgsqlConnector.ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode)
at Npgsql.NpgsqlConnector.HandleAuthentication(String username, NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout)
at Npgsql.ConnectorPool.Allocate(NpgsqlConnection conn, NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnection.OpenInternal()
at Worker.Program.OpenDbConnection(String connectionString) in /code/src/Worker/Program.cs:line 78
at Worker.Program.Main(String[] args) in /code/src/Worker/Program.cs:line 19
The problem, I think, is that the .NET code of the worker is a bit rigid, and it doesn’t handle certain situations well. There are several work-arounds for this in the voting app. The one I usually use is to make the postgresql db pod more “forgiving” in how it lets the worker connect to it. So the fix for the worker pod is, paradoxically, to modify the db pod. I do this:
env:
- name: POSTGRES_USER
value: "postgres"
- name: POSTGRES_PASSWORD
value: "postgres"
- name: POSTGRES_HOST_AUTH_METHOD ## add this line
value: trust ## and this linne
This is not something you’d do in a production app, to put it mildly. But it will make the voting app work for you, which is fine for the level of this particular course.
Awesome. This worked like a charm.
Thank you Rob!
Also, if you were using the YAML that is presented in the course slides, it is out of date. The course is currently being updated and the new YAML for the voting app that will be used can be found here.
That’s right. I am writing YAMLS in the way presented in the course slides.
Cool. I will check these out!
Thank you Alistair!