kubectl version : Error from server (Forbidden)

5/4/2019

I want to deploy my pods on kube8 cluster using jenkins job. But when check kubectl version :

Client Version: version.Info{Major:"1", Minor:"11",
GitVersion:"v1.11.6",
GitCommit:"b1d75deca493a24a2f87eb1efde1a569e52fc8d9",
GitTreeState:"clean", BuildDate:"2018-12-16T04:39:52Z",
GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"} Error
from server (Forbidden): <html><head><meta http-equiv='refresh'
content='1;url=/securityRealm/commenceLogin?from=%2Fversion%3Ftimeout%3D32s'/><script>window.location.replace('/securityRealm/commenceLogin?from=%2Fversion%3Ftimeout%3D32s');</script></head><body
style='background-color:white; color:white;'>

And kubectl cluster-info

Kubernetes master is running at http://localhost:8080

It is not getting connected with server. I have exported all the required Environment variables such as AWS_KEY etc to access the cluster. When i ssh into machine and manually export env variables and check kubectl version , it works fine .

-- Gaurav Gola
jenkins
kubernetes
kubernetes-helm

1 Answer

5/6/2019

you must be using jenkins service account to deploy the pod. ensure the service account has proper roles and rolebinding attached to deploy the pods in the cluster.

-- P Ekambaram
Source: StackOverflow