Nginx ingress install failure

noob to k8s here. so I’ve got a GKE cluster deployed. great! trying to deploy the nginx ingress controller, but keeps failing to start. later learned that I needed to install admission control. I’ve done that but the pod is still not getting a secret mounted. any ideas what else I could be missing?

I’ve confirmed that the pod has the appropriate service account attached.

Here is the error from the deployment log.

W0307 22:31:29.471002 10 client_config.go:548] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.

W0307 22:31:29.471097 10 client_config.go:553] error creating inClusterConfig, falling back to default config: failed to read token file “/var/run/secrets/”: open /var/run/secrets/ no such file or directory

F0307 22:31:29.471201 10 main.go:248] Error while initiating a connection to the Kubernetes API server. This could mean the cluster is misconfigured (e.g. it has invalid API server certificates or Service Accounts configuration). Reason: invalid configuration: no configuration has been provided

How are you trying to install it, Helm or through the nginx-install guide?

Just following the ningx-install guide.

Had to add the attribute “autoMountServiceAccountToken” to my pod spec. Not sure why it is not auto mounting in this new cluster. It was not an attribute that was set in our older clusters.

1 Like

Oh wow weird. It would have taken me a while to get to that one. Glad you were able to sort it out :slight_smile:

Was there a podsecuritypolicy in place preventing the automount?

Just wanted to say thanks, as this worked for me! I was COMPLETELY stumped until I stumbled across this solution, cheers!

(FWIW I was trying to install ingress via Terraform’s Kubernetes provider, and I needed to add the automount_service_account_token = true to the pod spec for this to work (but wasn’t required if I installed via kubectl/yaml.)

thanks this one worked for me,
without adding this line applying via yaml file was working,but i was applying through kubebuilder crd,
it was giving me kubekonfig errors.
after adding this line ,everything is working just fine!