提交 dac497f2 编写于 作者: S Shu Muto 提交者: Kubernetes Prow Robot

Migrate docs for Accessing Dashboard (#4224)

上级 ee1cc51a
......@@ -10,10 +10,10 @@
* [Installation](user/installation.md)
* [Certificate management](user/certificate-management.md)
* [Accessing Dashboard](user/accessing-dashboard.md)
* [Accessing Dashboard](user/accessing-dashboard/README.md)
* [1.7.x and above](user/accessing-dashboard/1.7.x-and-above.md)
* [1.6.x and below](user/accessing-dashboard/1.6.x-and-below.md)
* [Access control](user/access-control.md)
* [Access control](user/access-control/README.md)
* [Creating sample user](user/access-control/creating-sample-user.md)
* [Integrations](user/integrations.md)
* [Labels](user/labels.md)
......
# Accessing Dashboard 1.6.x and below
___It will be moved soon, for now you can [visit Wiki](https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard---1.6.X-and-below).___
## `kubectl proxy`
`kubectl proxy` creates proxy server between your machine and Kubernetes API server. By default it is only accessible locally (from the machine that started it).
First let's check if `kubectl` is properly configured and has access to the cluster. In case of error follow [this guide](https://kubernetes.io/docs/tasks/tools/install-kubectl/) to install and set up `kubectl`.
```
$ kubectl cluster-info
# Example output
Kubernetes master is running at https://192.168.30.148:6443
Heapster is running at https://192.168.30.148:6443/api/v1/namespaces/kube-system/services/heapster/proxy
KubeDNS is running at https://192.168.30.148:6443/api/v1/namespaces/kube-system/services/kube-dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
```
Start local proxy server.
```
$ kubectl proxy
Starting to serve on 127.0.0.1:8001
```
Once proxy server is started you should be able to access Dashboard from your browser at: `http://localhost:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/`.
## NodePort
This way of accessing Dashboard is only recommended for development environments in a single node setup.
Edit `kubernetes-dashboard` service.
```
$ kubectl -n kube-system edit service kubernetes-dashboard
```
You should see `yaml` representation of the service. Change `type: ClusterIP` to `type: NodePort` and save file. If it's already changed go to next step.
```
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-09-11T08:00:46Z
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system
resourceVersion: "1300"
selfLink: /api/v1/namespaces/kube-system/services/kubernetes-dashboard
uid: 51392867-96c7-11e7-87e0-901b0e532516
spec:
clusterIP: 10.103.169.125
externalTrafficPolicy: Cluster
ports:
- port: 80
protocol: TCP
targetPort: 9090
selector:
k8s-app: kubernetes-dashboard
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
```
Next we need to check port on which Dashboard was exposed.
```
$ kubectl -n kube-system get service kubernetes-dashboard
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes-dashboard 10.103.169.125 <nodes> 80:32703/TCP 1d
```
Dashboard has been exposed on a port `32703`. Now you can access it from your browser at: `http://<master-ip>:32703`. `master-ip` can be found by executing `kubectl cluster-info`. Usually it is either `127.0.0.1` or IP of your machine, assuming that you cluster is running directly on the machine, on which these commands are executed.
## API Server
In case Kubernetes API server is exposed and accessible from outside you can directly access dashboard at: `http(s)://<master-ip>:<apiserver-port>/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/`.
## Ingress
Dashboard can be also exposed using Ingress resource. For more information check: https://kubernetes.io/docs/concepts/services-networking/ingress.
----
_Copyright 2019 [The Kubernetes Dashboard Authors](https://github.com/kubernetes/dashboard/graphs/contributors)_
# Accessing Dashboard 1.7.x and above
___It will be moved soon, for now you can [visit Wiki](https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard---1.7.X-and-above).___
**IMPORTANT:** HTTPS endpoints are only available if you used [Recommended Setup](../installation.md#recommended-setup), followed [Getting Started](../../../README.md#getting-started) guide to deploy Dashboard or manually provided `--tls-key-file` and `--tls-cert-file` flags. In case you did not and you access Dashboard over HTTP, then Dashboard can be accessed the same way as [older versions](./1.6.x-and-below.md).
**NOTE:** Dashboard should not be exposed publicly over HTTP. For domains accessed over HTTP it will not be possible to sign in. Nothing will happen after clicking Sign in button on login page.
## `kubectl proxy`
`kubectl proxy` creates proxy server between your machine and Kubernetes API server. By default it is only accessible locally (from the machine that started it).
First let's check if `kubectl` is properly configured and has access to the cluster. In case of error follow [this guide](https://kubernetes.io/docs/tasks/tools/install-kubectl/) to install and set up `kubectl`.
```
$ kubectl cluster-info
# Example output
Kubernetes master is running at https://192.168.30.148:6443
KubeDNS is running at https://192.168.30.148:6443/api/v1/namespaces/kube-system/services/kube-dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
```
Start local proxy server.
```
$ kubectl proxy
Starting to serve on 127.0.0.1:8001
```
Once proxy server is started you should be able to access Dashboard from your browser.
To access HTTPS endpoint of dashboard go to: `http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/`
NOTE: Dashboard should not be exposed publicly using `kubectl proxy` command as it only allows HTTP connection. For domains other than `localhost` and `127.0.0.1` it will not be possible to sign in. Nothing will happen after clicking `Sign in` button on login page.
## `kubectl port-forward`
Instead of `kubectl proxy`, you can use `kubectl port-forward` and access dashboard with simpler URL than using `kubectl proxy`.
```
kube@minikube:~$ kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 10443:443
Forwarding from 127.0.0.1:10443 -> 8443
```
NOTE: If you need to expose dashboard to other hosts except host running `kubectl`, you should set `--address [ IP address that your browser's host has ]` option. You can set this option as `--address 0.0.0.0`, but it means exposing publicly.
## NodePort
This way of accessing Dashboard is only recommended for development environments in a single node setup.
Edit `kubernetes-dashboard` service.
```
$ kubectl -n kubernetes-dashboard edit service kubernetes-dashboard
```
You should see `yaml` representation of the service. Change `type: ClusterIP` to `type: NodePort` and save file. If it's already changed go to next step.
```
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
...
name: kubernetes-dashboard
namespace: kubernetes-dashboard
resourceVersion: "343478"
selfLink: /api/v1/namespaces/kubernetes-dashboard/services/kubernetes-dashboard
uid: 8e48f478-993d-11e7-87e0-901b0e532516
spec:
clusterIP: 10.100.124.90
externalTrafficPolicy: Cluster
ports:
- port: 443
protocol: TCP
targetPort: 8443
selector:
k8s-app: kubernetes-dashboard
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
```
Next we need to check port on which Dashboard was exposed.
```
$ kubectl -n kubernetes-dashboard get service kubernetes-dashboard
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes-dashboard NodePort 10.100.124.90 <nodes> 443:31707/TCP 21h
```
Dashboard has been exposed on port `31707 (HTTPS)`. Now you can access it from your browser at: `https://<master-ip>:31707`. `master-ip` can be found by executing `kubectl cluster-info`. Usually it is either `127.0.0.1` or IP of your machine, assuming that your cluster is running directly on the machine, on which these commands are executed.
In case you are trying to expose Dashboard using `NodePort` on a multi-node cluster, then you have to find out IP of the node on which Dashboard is running to access it. Instead of accessing `https://<master-ip>:<nodePort>` you should access `https://<node-ip>:<nodePort>`.
## API Server
In case Kubernetes API server is exposed and accessible from outside you can directly access dashboard at: `https://<master-ip>:<apiserver-port>/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/`
**Note:** This way of accessing Dashboard is only possible if you choose to install your user certificates in the browser. In example certificates used by kubeconfig file to contact API Server can be used.
## Ingress
Dashboard can be also exposed using Ingress resource. For more information check: https://kubernetes.io/docs/concepts/services-networking/ingress.
----
_Copyright 2019 [The Kubernetes Dashboard Authors](https://github.com/kubernetes/dashboard/graphs/contributors)_
# Accessing Dashboard
___It will be moved soon, for now you can [visit Wiki](https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard).___
Once Dashboard is installed on your cluster it can be accessed in a few different ways. Note that this document does not describe all possible ways of accessing cluster applications. In case of any error while trying to access Dashboard, please first read our [FAQ](../../common/faq.md) and check [closed issues](https://github.com/kubernetes/dashboard/issues?q=is%3Aissue+is%3Aclosed). In most cases errors are caused by cluster configuration issues.
Choose version of Dashboard you are using to get information about how to access it:
* [1.7.x and above](1.7.x-and-above.md)
* [1.6.x and below](1.6.x-and-below.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册