Kubernetes master at https://localhost:6443. Not able to login

1/23/2020

I've installed docker for desktop v2.0.0.3. I'm able to see cluster info using kubectl command. kubectl cluster-info which gives
Kubernetes master is running at https://localhost:6443.
Now when I try to login to https://localhost:6443 it doesn't ask for credentials and shows me 404 forbidden message . below is the entire trace -

{   "kind": "Status",   "apiVersion": "v1",   "metadata": {
       },   "status": "Failure",   "message": "forbidden: User \"system:anonymous\" cannot get path \"/\"",   "reason": "Forbidden",  "details": {
       },   "code": 403 }
-- bosari
docker
kubectl
kubernetes

2 Answers

1/23/2020

You need a bearer token or a client certificate for accessing the kubernetes API.

Easiest option is to access it via kubectl proxy wherein kubectl will make use of kubeconfig to perform the authentication so you don't need to provide any certificate or token separately.

-- Arghya Sadhu
Source: StackOverflow

1/23/2020

Execute the following command; which will make kubectl behave as reverse proxy:

$ kubectl proxy --port=8080 &

You can use any other available port, then access the kubernetes api server on that port.

$ curl http://localhost:8080/api/
-- Jaraws
Source: StackOverflow