Search code examples
dockerbasic-authenticationkubernetestls1.2

How to connect to kubernetes-api from a browser?


I set up a cybernetes cluster this tutorial https://coreos.com/kubernetes/docs/latest/deploy-master.html

When you open the browser https://my_ip I get Unauthorized.

What you need to do to access the API?

~/kubectl config view`

apiVersion: v1 clusters: - cluster: certificate-authority: /home/hhh/ca.pem server: https://192.168.0.139 name: default-cluster contexts: - context: cluster: hhh-cluster user: hhh name: default-system current-context: default-system kind: Config preferences: {} users: - name: cluster-hhh user: password: admin username: admin - name: default-admin user: client-certificate: /home/hhh/admin.pem client-key: /home/hhh/admin-key.pem

basic-auth not work


Solution

  • Does basic auth work when using kubectl (it's unclear from your output which client credentials are working when connecting to your cluster's apiserver)?

    Are you passing --basic-auth-file to your kube-apiserver process when starting it (see https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-apiserver/app/server.go#L218)? If not, then basic auth will not work when connecting to your apiserver? If so, you can verify that it is working by running curl -k --user admin:admin https://192.168.0.139.

    If you want (or need) to use client certificates from your browser, take a look at the instructions I put into this github issue about making it easier to configure.