WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit a150d16

Browse files
committed
feat(demo): add fancy demo for HA cluster with demo app
1 parent 23e1442 commit a150d16

File tree

15 files changed

+277
-0
lines changed

15 files changed

+277
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ bin/
33

44
# Ignore Vagrant state.
55
.vagrant/
6+
7+
# Ignore downloaded Helm charts.
8+
deploy/demo/**/charts

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,31 @@ docker:
5151
.PHONY: clean
5252
clean:
5353
@rm -rvf bin
54+
55+
.PHONY: demo-up
56+
demo-up: install
57+
@echo -n "\e[35m==>\e[0m "
58+
k3se up deploy/demo/k3se.yaml
59+
@echo -n "\e[35m==>\e[0m "
60+
61+
@echo -n "\e[35m==>\e[0m "
62+
kubectl create ns traefik --dry-run=client -o yaml | kubectl apply -f -
63+
@echo -n "\e[35m==>\e[0m "
64+
helm dependency update deploy/demo/traefik
65+
@echo -n "\e[35m==>\e[0m "
66+
helm upgrade --install traefik deploy/demo/traefik --namespace traefik
67+
@echo -n "\e[35m==>\e[0m "
68+
kubectl create ns cert-manager --dry-run=client -o yaml | kubectl apply -f -
69+
@echo -n "\e[35m==>\e[0m "
70+
helm dependency update deploy/demo/cert-manager
71+
@echo -n "\e[35m==>\e[0m "
72+
helm upgrade --install cert-manager deploy/demo/cert-manager --namespace cert-manager
73+
@echo -n "\e[35m==>\e[0m "
74+
kubectl apply -f deploy/demo/clusterissuers
75+
@echo -n "\e[35m==>\e[0m "
76+
kubectl apply -f deploy/demo/app
77+
78+
.PHONY: demo-down
79+
demo-down:
80+
@echo -n "\e[35m==>\e[0m "
81+
k3se down deploy/demo/k3se.yaml

deploy/demo/app/deployment.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: kuard
5+
spec:
6+
selector:
7+
matchLabels:
8+
app.kubernetes.io/name: kuard
9+
# I don't want to mess with anti-affinities so let's
10+
# just create enough pods to spread them across nodes.
11+
replicas: 9
12+
template:
13+
metadata:
14+
labels:
15+
app.kubernetes.io/name: kuard
16+
spec:
17+
containers:
18+
- image: gcr.io/kuar-demo/kuard-amd64:1
19+
imagePullPolicy: Always
20+
name: kuard
21+
ports:
22+
- containerPort: 8080
23+
resources:
24+
requests:
25+
cpu: 128m
26+
memory: 128Mi
27+
# Limits are tricky, but I don't
28+
# want warnings here, so I added them.
29+
limits:
30+
cpu: 128m
31+
memory: 128Mi

deploy/demo/app/ingress.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: kuard
5+
labels:
6+
app.kubernetes.io/name: kuard
7+
annotations:
8+
cert-manager.io/cluster-issuer: "letsencrypt-production"
9+
spec:
10+
ingressClassName: traefik
11+
tls:
12+
- hosts:
13+
- k3se.nicklasfrahm.xyz
14+
secretName: kuard-tls
15+
rules:
16+
- host: k3se.nicklasfrahm.xyz
17+
http:
18+
paths:
19+
- path: /
20+
pathType: Prefix
21+
backend:
22+
service:
23+
name: kuard
24+
port:
25+
name: http

deploy/demo/app/service.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: kuard
5+
spec:
6+
ports:
7+
- name: http
8+
port: 80
9+
targetPort: 8080
10+
protocol: TCP
11+
selector:
12+
app.kubernetes.io/name: kuard
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: cert-manager
3+
repository: https://charts.jetstack.io
4+
version: v1.9.1
5+
digest: sha256:b3c1f49120842cf9da8e5e7c2102b73735c32eefcaacfcffe0bcd0ae85b2c9bc
6+
generated: "2022-08-16T20:03:04.998492102+02:00"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v2
2+
name: cert-manager
3+
description: An umbrella chart to configure cert-manager.
4+
version: 1.9.1
5+
dependencies:
6+
- name: cert-manager
7+
version: 1.9.1
8+
repository: https://charts.jetstack.io
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cert-manager:
2+
installCRDs: true
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: cert-manager.io/v1
2+
kind: ClusterIssuer
3+
metadata:
4+
name: letsencrypt-production
5+
spec:
6+
acme:
7+
server: https://acme-v02.api.letsencrypt.org/directory
8+
preferredChain: ISRG Root X1
9+
10+
privateKeySecretRef:
11+
name: letsencrypt-production-clusterissuer-key
12+
solvers:
13+
- http01:
14+
ingress:
15+
class: traefik
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: cert-manager.io/v1
2+
kind: ClusterIssuer
3+
metadata:
4+
name: letsencrypt-staging
5+
spec:
6+
acme:
7+
server: https://acme-staging-v02.api.letsencrypt.org/directory
8+
preferredChain: ISRG Root X1
9+
10+
privateKeySecretRef:
11+
name: letsencrypt-staging-clusterissuer-key
12+
solvers:
13+
- http01:
14+
ingress:
15+
class: traefik

0 commit comments

Comments
 (0)