Skip to content

Commit 1478bde

Browse files
committed
1 parent 614e5d6 commit 1478bde

File tree

411 files changed

+40568
-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.

411 files changed

+40568
-0
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.idea
2+
*.iml
3+
build/
4+
target/
5+
node_modules/
6+
npm-debug.log*
7+
**/tailwind.css
8+

README.md

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# YAKC - Kubernetes Dashboard
2+
3+
PoC to show how to build a Kubernetes dashboard with YAKC,
4+
[Quarkus](https://quarkus.io) and [React](https://www.reactjs.org).
5+
6+
## Click the video to see a demo of the Dashboard
7+
8+
[![Thumbnail of video of a demo for YAKC - Kubernetes Dashboard](https://img.youtube.com/vi/Dum84fwA8_g/maxresdefault.jpg)](https://www.youtube.com/watch?v=Dum84fwA8_g)
9+
10+
11+
## Getting started
12+
13+
### Minikube
14+
15+
If you want just to check-out the final project the easiest way is to deploy the
16+
[released snapshot](https://hub.docker.com/r/marcnuri/yakc-kubernetes-dashboard)
17+
into Minikube (or any other k8s cluster - needs access to node):
18+
19+
```shell script
20+
# Deploy the application using https://hub.docker.com/r/marcnuri/yakc-kubernetes-dashboard SNAPSHOT
21+
$ kubectl create -f https://raw.githubusercontent.com/manusa/yakc/master/quickstarts/quarkus-dashboard/docs/yakc-kubernetes-dashboard.minikube.yml
22+
# Open Browser and navigate to deployed application
23+
$ minikube service yakc-dashboard
24+
```
25+
26+
![An image of a screenshot YAKC Kubernetes Dashboard landing page](docs/yakc-kubernetes-dashboard.gif)
27+
28+
### OpenShift Katacoda
29+
30+
You can test YAKC Kubernetes Dashboard by taking advantage of the OpenShift getting started Katacoda.
31+
32+
Access the Course (from Red Hat): https://learn.openshift.com/introduction/cluster-access/
33+
34+
Or access the Course (from Katacoda): https://www.katacoda.com/openshift/courses/developing-on-openshift/getting-started/
35+
36+
When the terminal loads, apply the provided YAKC Kubernetes Dashboard configuration:
37+
38+
```shell script
39+
#
40+
# Deploy the application using https://hub.docker.com/r/marcnuri/yakc-kubernetes-dashboard SNAPSHOT
41+
#
42+
$ oc create -f https://raw.githubusercontent.com/manusa/yakc/master/quickstarts/quarkus-dashboard/docs/yakc-kubernetes-dashboard.openshift-4.yml
43+
service/yakc-quarkus-kubernetes-dashboard created
44+
clusterrolebinding.rbac.authorization.k8s.io/yakc-kubernetes-dashboard-cluster-admin created
45+
deployment.apps/yakc-quarkus-kubernetes-dashboard created
46+
route.route.openshift.io/yakc-quarkus-kubernetes-dashboard created
47+
#
48+
# Retrieve URL for created route
49+
#
50+
$ echo "http://$(oc get route yakc-quarkus-kubernetes-dashboard -o jsonpath='{.spec.host}')"
51+
http://yakc-dashboard-default.1337-13-kota037.environments.katacoda.com
52+
```
53+
54+
Now you can open the URL in your browser.
55+
56+
## Build
57+
58+
To build the whole project (Front-end & Back-end), the easiest way is to run the Maven build with
59+
the provided profile `build-frontend`.
60+
61+
```shell script
62+
# Build project
63+
$ mvn clean package -Pbuild-frontend
64+
```
65+
66+
### Native image
67+
68+
Build the application using the `native` property.
69+
```shell script
70+
# On Windows first you need to run this
71+
$ "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" && mvn clean install -Pnative
72+
# To build (You can combine with the front-end build profiles)
73+
$ mvn clean package -Dnative
74+
```
75+
76+
#### (Windows) Install vc build tools
77+
78+
```shell script
79+
$ choco install -y visualstudio2017community --no-progress --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.CMake.Project"
80+
```
81+
82+
## Build & Deploy to Minikube using Maven
83+
84+
Follow these instructions if you want to build & deploy the project into a Kubernetes Cluster, in
85+
this case Minikube.
86+
87+
```shell script
88+
# Provide access to Minikube's Docker daemon (allows to skip pushing the generated image)
89+
$ eval $(minikube docker-env)
90+
# Build and deploy project
91+
$ mvn clean install -Pbuild-frontend,k8s
92+
# Open Browser and navigate to deployed application
93+
$ minikube service yakc-dashboard
94+
```
95+
96+
This will also add a role binding for the default service account to the cluster-admin role in the
97+
`default` namespace. In case you are working on a different namespace you can customize this
98+
value by providing a value for the `k8s.namespace` project property:
99+
100+
```shell script
101+
# Build and deploy project to custom namespace
102+
$ mvn clean install -Pbuild-frontend,k8s -Dk8s.namespace=custom
103+
```
104+
105+
## Development
106+
107+
You can work on the project with hot reload by starting both applications separately.
108+
109+
### Back-End
110+
111+
The back-end application is a Quarkus application, you can start it in development mode by:
112+
```shell script
113+
$ mvn quarkus:dev
114+
```
115+
116+
### Front-End
117+
118+
You can find the React client application in the [`src/main/frontend`](src/main/frontend)
119+
directory.
120+
121+
```shell script
122+
# Install required dependencies
123+
$ npm install
124+
# Start development mode
125+
$ npm start
126+
```
127+
128+
You can point your browser to [localhost:3000](http://localhost:3000).

docs/yakc-kubernetes-dashboard.gif

1.62 MB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
apiVersion: v1
3+
kind: List
4+
items:
5+
- apiVersion: v1
6+
kind: Service
7+
metadata:
8+
labels:
9+
expose: "true"
10+
app: quarkus-kubernetes-dashboard
11+
group: com.marcnuri.yakc.quickstart
12+
name: yakc-dashboard
13+
spec:
14+
ports:
15+
- name: http
16+
port: 8080
17+
protocol: TCP
18+
targetPort: 8080
19+
selector:
20+
app: quarkus-kubernetes-dashboard
21+
group: com.marcnuri.yakc.quickstarts
22+
type: NodePort
23+
- apiVersion: rbac.authorization.k8s.io/v1
24+
kind: ClusterRoleBinding
25+
metadata:
26+
labels:
27+
app: quarkus-kubernetes-dashboard
28+
group: com.marcnuri.yakc.quickstarts
29+
name: yakc-kubernetes-dashboard-cluster-admin
30+
roleRef:
31+
kind: ClusterRole
32+
apiGroup: rbac.authorization.k8s.io
33+
name: cluster-admin
34+
subjects:
35+
- kind: ServiceAccount
36+
name: default
37+
namespace: default
38+
- apiVersion: apps/v1
39+
kind: Deployment
40+
metadata:
41+
labels:
42+
app: quarkus-kubernetes-dashboard
43+
group: com.marcnuri.yakc.quickstarts
44+
name: quarkus-kubernetes-dashboard
45+
spec:
46+
replicas: 1
47+
revisionHistoryLimit: 2
48+
selector:
49+
matchLabels:
50+
app: quarkus-kubernetes-dashboard
51+
group: com.marcnuri.yakc.quickstarts
52+
template:
53+
metadata:
54+
labels:
55+
app: quarkus-kubernetes-dashboard
56+
group: com.marcnuri.yakc.quickstarts
57+
spec:
58+
containers:
59+
- env:
60+
- name: KUBERNETES_NAMESPACE
61+
valueFrom:
62+
fieldRef:
63+
fieldPath: metadata.namespace
64+
- name: HOSTNAME
65+
valueFrom:
66+
fieldRef:
67+
fieldPath: metadata.name
68+
- name: YAKC_DASHBOARD_INSECURESKIPTLSVERIFY
69+
value: "false"
70+
image: marcnuri/yakc-kubernetes-dashboard:latest
71+
imagePullPolicy: Always
72+
name: quarkus
73+
ports:
74+
- containerPort: 8080
75+
name: http
76+
protocol: TCP
77+
securityContext:
78+
privileged: false
79+
resources:
80+
limits:
81+
memory: "128Mi"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
apiVersion: v1
3+
kind: List
4+
items:
5+
- apiVersion: v1
6+
kind: Service
7+
metadata:
8+
labels:
9+
expose: "true"
10+
app: yakc-quarkus-kubernetes-dashboard
11+
group: com.marcnuri.yakc.quickstart
12+
name: yakc-quarkus-kubernetes-dashboard
13+
spec:
14+
ports:
15+
- name: http
16+
port: 8080
17+
protocol: TCP
18+
targetPort: 8080
19+
selector:
20+
app: yakc-quarkus-kubernetes-dashboard
21+
group: com.marcnuri.yakc.quickstarts
22+
type: NodePort
23+
- apiVersion: rbac.authorization.k8s.io/v1
24+
kind: ClusterRoleBinding
25+
metadata:
26+
labels:
27+
app: yakc-quarkus-kubernetes-dashboard
28+
group: com.marcnuri.yakc.quickstarts
29+
name: yakc-kubernetes-dashboard-cluster-admin
30+
roleRef:
31+
kind: ClusterRole
32+
apiGroup: rbac.authorization.k8s.io
33+
name: cluster-admin
34+
subjects:
35+
- kind: ServiceAccount
36+
name: default
37+
namespace: default
38+
- apiVersion: apps/v1
39+
kind: Deployment
40+
metadata:
41+
labels:
42+
app: yakc-quarkus-kubernetes-dashboard
43+
group: com.marcnuri.yakc.quickstarts
44+
name: yakc-quarkus-kubernetes-dashboard
45+
spec:
46+
replicas: 1
47+
revisionHistoryLimit: 2
48+
selector:
49+
matchLabels:
50+
app: yakc-quarkus-kubernetes-dashboard
51+
group: com.marcnuri.yakc.quickstarts
52+
template:
53+
metadata:
54+
labels:
55+
app: yakc-quarkus-kubernetes-dashboard
56+
group: com.marcnuri.yakc.quickstarts
57+
spec:
58+
containers:
59+
- env:
60+
- name: KUBERNETES_NAMESPACE
61+
valueFrom:
62+
fieldRef:
63+
fieldPath: metadata.namespace
64+
- name: HOSTNAME
65+
valueFrom:
66+
fieldRef:
67+
fieldPath: metadata.name
68+
- name: YAKC_DASHBOARD_INSECURESKIPTLSVERIFY
69+
value: "true"
70+
image: marcnuri/yakc-kubernetes-dashboard:latest
71+
imagePullPolicy: Always
72+
name: yakc-quarkus-kubernetes-dashboard
73+
ports:
74+
- containerPort: 8080
75+
name: http
76+
protocol: TCP
77+
securityContext:
78+
privileged: false
79+
- apiVersion: route.openshift.io/v1
80+
kind: Route
81+
metadata:
82+
labels:
83+
app: yakc-quarkus-kubernetes-dashboard
84+
group: com.marcnuri.yakc.quickstart
85+
name: yakc-quarkus-kubernetes-dashboard
86+
spec:
87+
path: /
88+
to:
89+
kind: Service
90+
name: yakc-quarkus-kubernetes-dashboard
91+
port:
92+
targetPort: 8080

docs/yakc-kubernetes-dashboard.png

58.3 KB
Loading

0 commit comments

Comments
 (0)