|
| 1 | +# k8dash |
| 2 | + |
| 3 | +K8dash is a dashboard for monitoring and managing Kubernetes clusters. It heavily utilizes [metrics server](https://github.com/kubernetes-incubator/metrics-server) to quickly and easily visualize the health of nodes and pods. K8dash also utilizes the streaming apis provided by Kubernetes to update cluster state and metrics in real time. No need to refresh pages to monitor status updates. |
| 4 | + |
| 5 | +Why might you want to use k8dash instead of the default Kubernetes dashboard? |
| 6 | +* Streaming updates. No need to refresh pages to see latest status |
| 7 | +* Full OpenID integration out-of-the-box. No need to configure an authenticating proxy to sit in front. |
| 8 | +* Interates with metrics-server to display realtime metrics |
| 9 | + |
| 10 | +## Workloads View |
| 11 | + |
| 12 | + |
| 13 | +## Realtime streaming of status |
| 14 | +Notice how the UI automatically reflects changes to the cluster in realtime after scaling a deployment |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | ++ A running Kubernetes cluster |
| 20 | ++ [metrics server](https://github.com/kubernetes-incubator/metrics-server) installed (optional, but strongly recommended) |
| 21 | ++ A Kubernetes cluster configured for [OpenId Connect](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#openid-connect-tokens) authentication (optional) |
| 22 | + |
| 23 | +## Getting Started |
| 24 | +Deploy k8dash with something like the following... |
| 25 | + |
| 26 | +NOTE: never trust a file downloaded from the internet. Make sure to review the contents of [kubernetes-k8dash.yaml](https://raw.githubusercontent.com/herbrandson/k8dash/kubernetes-k8dash.yaml) before running the script below. |
| 27 | + |
| 28 | +``` bash |
| 29 | +kubectl apply -f https://raw.githubusercontent.com/herbrandson/k8dash/kubernetes-k8dash.yaml |
| 30 | +``` |
| 31 | + |
| 32 | +To access k8dash from your local workstation you must create a secure channel to your Kubernetes cluster. Run the following command: |
| 33 | + |
| 34 | +``` bash |
| 35 | +kubectl proxy |
| 36 | +``` |
| 37 | + |
| 38 | +You can then access the ui at [http://localhost:8001/api/v1/namespaces/kube-system/services/http:k8dash:/proxy/](http://localhost:8001/api/v1/namespaces/kube-system/services/http:k8dash:/proxy/) |
| 39 | + |
| 40 | +Alternatively, if you have an ingress server setup, you can simply add a route like the following |
| 41 | + |
| 42 | +``` yaml |
| 43 | +kind: Ingress |
| 44 | +apiVersion: extensions/v1beta1 |
| 45 | +metadata: |
| 46 | + name: k8dash |
| 47 | + namespace: kube-system |
| 48 | +spec: |
| 49 | + rules: |
| 50 | + - |
| 51 | + host: k8dash.example.com |
| 52 | + http: |
| 53 | + paths: |
| 54 | + - |
| 55 | + path: / |
| 56 | + backend: |
| 57 | + serviceName: k8dash |
| 58 | + servicePort: 80 |
| 59 | +``` |
| 60 | +
|
| 61 | +
|
| 62 | +# Logging in |
| 63 | +There are multiple options logging into the dashboard. |
| 64 | +
|
| 65 | +## Service Account Token |
| 66 | +The first (and easiest) option is to create a dedicated service account. The can be accomplished using the following script. |
| 67 | +
|
| 68 | +``` bash |
| 69 | +# Create the service account in the current namespace (we assume default) |
| 70 | +kubectl create serviceaccount k8dash-sa |
| 71 | + |
| 72 | +# Give that service account root on the cluster |
| 73 | +kubectl create clusterrolebinding k8dash-sa --clusterrole=cluster-admin --serviceaccount=default:k8dash-sa |
| 74 | + |
| 75 | +# Find the secret that was created to hold the token for the SA |
| 76 | +kubectl get secrets |
| 77 | + |
| 78 | +# Show the contents of the secret to extract the token |
| 79 | +kubectl describe secret k8dash-sa-token-xxxxx |
| 80 | + |
| 81 | +``` |
| 82 | + |
| 83 | +Retrieve the `token` value from the secret and enter it into the login screen to access the dashboard. |
| 84 | + |
| 85 | +## Running k8dash with OpenId Connect (oidc) |
| 86 | +K8dash makes using OpenId Connect for authentication easy. Assuming your cluster is configured to use OIDC, all you need to do is create a secret containing your credentials and run the [kubernetes-k8dash-oidc.yaml](https://raw.githubusercontent.com/herbrandson/k8dash/kubernetes-k8dash-oidc.yaml) config. |
| 87 | + |
| 88 | +To learn more about configuring a cluster for OIDC, check out these great links |
| 89 | ++ [https://kubernetes.io/docs/reference/access-authn-authz/authentication/](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#openid-connect-tokens) |
| 90 | ++ [https://medium.com/@mrbobbytables/kubernetes-day-2-operations-authn-authz-with-oidc-and-a-little-help-from-keycloak-de4ea1bdbbe](https://medium.com/@mrbobbytables/kubernetes-day-2-operations-authn-authz-with-oidc-and-a-little-help-from-keycloak-de4ea1bdbbe) |
| 91 | ++ [https://medium.com/@int128/kubectl-with-openid-connect-43120b451672](https://medium.com/@int128/kubectl-with-openid-connect-43120b451672) |
| 92 | ++ [https://www.google.com/search?q=kubernetes+configure+oidc&oq=kubernetes+configure+oidc&aqs=chrome..69i57j0.4772j0j7&sourceid=chrome&ie=UTF-8](https://www.google.com/search?q=kubernetes+configure+oidc&oq=kubernetes+configure+oidc&aqs=chrome..69i57j0.4772j0j7&sourceid=chrome&ie=UTF-8) |
| 93 | + |
| 94 | +You can deploy k8dash with oidc support using something like the following script... |
| 95 | + |
| 96 | +NOTE: never trust a file downloaded from the internet. Make sure to review the contents of [kubernetes-k8dash-oidc.yaml](https://raw.githubusercontent.com/herbrandson/k8dash/kubernetes-k8dash-oidc.yaml) before running the script below. |
| 97 | + |
| 98 | +``` bash |
| 99 | +OIDC_URL=<put your endpoint url here... something like https://accounts.google.com> |
| 100 | +OIDC_ID=<put your id here... something like blah-blah-blah.apps.googleusercontent.com> |
| 101 | +OIDC_SECRET=<put your oidc secret here> |
| 102 | + |
| 103 | +kubectl create secret -n kube-system generic k8dash \ |
| 104 | +--from-literal=url="$OIDC_URL" \ |
| 105 | +--from-literal=id="$OIDC_ID" \ |
| 106 | +--from-literal=secret="$OIDC_SECRET" |
| 107 | + |
| 108 | +kubectl apply -f https://raw.githubusercontent.com/herbrandson/k8dash/kubernetes-k8dash-oidc.yaml |
| 109 | + |
| 110 | +``` |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +## Metrics |
| 115 | +K8dash relies heavily on [metrics-server](https://github.com/kubernetes-incubator/metrics-server) to display real time cluster metrics. It is strongly recommended to have metrics-server installed to get the best experiance from k8dash. |
| 116 | + |
| 117 | ++ [Installing metrics-server](https://github.com/kubernetes-incubator/metrics-server) |
| 118 | ++ [Running metrics-server with kubeadm](https://medium.com/@waleedkhan91/how-to-configure-metrics-server-on-kubeadm-provisioned-kubernetes-cluster-f755a2ac43a2) |
0 commit comments