I've started kube-apiserver with the CA authentication with --secure-port=8181, and the insecure address and port is the default one(localhost:8080):
$ kubectl cluster-info
Kubernetes master is running at localhost:8080
kubernetes-dashboard is running at localhost:8080/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboardThe page of kubernetes-dashboard in browser returns me the following error:
Get http://localhost:8080/api/v1/replicationcontrollers: dial tcp [::1]:8080: getsockopt: connection refusedBut the url "httpS://domain:8181/api/v1/replicationcontrollers" will return the RCs as well.
So is there a way to use the secure port only? I mean that getting the access of kubernetes dashboard via https.
You can expose any Kubernetes Service via https by deploying an Ingress controller in front of it, like nginx: https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx. This nginx controller will terminate tls, so even if your backend doesn't support https it should work. There are several ways to enforce https through it: https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx#server-side-https-enforcement