Skip to content

Commit b229552

Browse files
author
Eric Herbrandson
committed
Initial commit
0 parents  commit b229552

File tree

162 files changed

+30767
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+30767
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
**/node_modules

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
TODO
3+
**/node_modules
4+
**/build

Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# THIS IS THE BASEIMAGE THAT ALL OTHER SERVICES ARE BUILT UPON
2+
3+
FROM node:11.10.0-alpine
4+
5+
RUN apk add --no-cache tini
6+
7+
ENV NODE_ENV production
8+
9+
RUN mkdir -p /usr/src/app
10+
WORKDIR /usr/src/app
11+
12+
RUN chown -R node:node /usr/src/app/
13+
14+
COPY server/package.json /usr/src/app/
15+
COPY server/package-lock.json /usr/src/app/
16+
RUN npm install --production
17+
18+
COPY client/build /usr/src/app/public
19+
COPY server /usr/src/app
20+
21+
USER node
22+
23+
ENTRYPOINT ["/sbin/tini", "--", "node", "."]

README.md

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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+
![Dashboard UI workloads page](docs/workloads.png)
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+
![Dashboard UI streaming](docs/k8dash.gif)
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)

client/.eslintrc

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"extends": ["airbnb-base","plugin:react/recommended"],
3+
"env": {
4+
"browser": true,
5+
"jest": true
6+
},
7+
"plugins": ["react"],
8+
"parser": "babel-eslint",
9+
"parserOptions": {
10+
"jsx": true
11+
},
12+
"rules": {
13+
"indent": [
14+
"error",
15+
4,
16+
{
17+
"SwitchCase": 1
18+
}
19+
],
20+
"eqeqeq": [
21+
"error",
22+
"always",
23+
{
24+
"null": "ignore"
25+
}
26+
],
27+
"object-curly-spacing": [
28+
"error",
29+
"never"
30+
],
31+
"object-curly-newline": [
32+
"error",
33+
{
34+
"consistent": true
35+
}
36+
],
37+
"no-use-before-define": [
38+
"error",
39+
{
40+
"functions": false
41+
}
42+
],
43+
"no-await-in-loop": "off",
44+
"no-restricted-syntax": "off",
45+
"no-plusplus": "off",
46+
"class-methods-use-this": "off",
47+
"react/prop-types": "off"
48+
}
49+
}

client/README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
## Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
### `npm start`
8+
9+
Runs the app in the development mode.<br>
10+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11+
12+
The page will reload if you make edits.<br>
13+
You will also see any lint errors in the console.
14+
15+
### `npm test`
16+
17+
Launches the test runner in the interactive watch mode.<br>
18+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19+
20+
### `npm run build`
21+
22+
Builds the app for production to the `build` folder.<br>
23+
It correctly bundles React in production mode and optimizes the build for the best performance.
24+
25+
The build is minified and the filenames include the hashes.<br>
26+
Your app is ready to be deployed!
27+
28+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29+
30+
### `npm run eject`
31+
32+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33+
34+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35+
36+
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37+
38+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39+
40+
## Learn More
41+
42+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43+
44+
To learn React, check out the [React documentation](https://reactjs.org/).
45+
46+
### Code Splitting
47+
48+
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49+
50+
### Analyzing the Bundle Size
51+
52+
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53+
54+
### Making a Progressive Web App
55+
56+
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57+
58+
### Advanced Configuration
59+
60+
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61+
62+
### Deployment
63+
64+
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65+
66+
### `npm run build` fails to minify
67+
68+
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

0 commit comments

Comments
 (0)