Commit 138b605 1 parent fbe21aa commit 138b605 Copy full SHA for 138b605
File tree 9 files changed +88
-44
lines changed
9 files changed +88
-44
lines changed Original file line number Diff line number Diff line change @@ -15,22 +15,34 @@ Powered with cutting edge *Foretold Termination™* technology (saves time on co
15
15
16
16
## Installation and usage
17
17
18
- ** Installation example with kind:**
18
+ ** kind cluster [ with ingress preparation ] ( https:// kind.sigs.k8s.io/docs/user/ingress/#using-ingress ) :**
19
19
```
20
20
# cluster creation with `kind`
21
21
kind create cluster --config=./kind.yaml
22
22
23
+ # ingress NGINX controller
24
+ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
25
+
26
+ # wait until is ready to process requests running
27
+ kubectl wait --namespace ingress-nginx \
28
+ --for=condition=ready pod \
29
+ --selector=app.kubernetes.io/component=controller \
30
+ --timeout=90s
31
+ ```
32
+
33
+ ** k8-calc installation:**
34
+ ```
23
35
# installation
24
36
helm install k8-calc k8-calc/
25
37
26
38
# verification -- should output "69"
27
- curl http:// localhost:30000/
39
+ curl localhost/k8_calc
28
40
```
29
41
30
42
** For different calculation * simply* do:**
31
43
+ run ` kubectl edit configmap calculateme-configmap `
32
44
+ change ` calculateme: 60+9 ` line, save and exit text editor
33
- + check ` http:// localhost:30000/ `
45
+ + check ` localhost/k8_calc `
34
46
35
47
** To remove everything:**
36
48
+ run ` kind delete cluster `
Original file line number Diff line number Diff line change
1
+ - [x] Ingres
2
+ - [ ] Argo CI/CD
3
+ - [ ] Terraform configs for AWS/GCP/Azure
Original file line number Diff line number Diff line change
1
+ ---
1
2
apiVersion : v2
2
3
name : k8_calc
3
4
description : https://github.com/banderlog/k8s_calc
Original file line number Diff line number Diff line change
1
+ ---
1
2
apiVersion : apps/v1
2
3
kind : Deployment
3
4
metadata :
@@ -17,20 +18,20 @@ spec:
17
18
app : bc
18
19
spec :
19
20
containers :
20
- - name : bc
21
- image : busybox
22
- env :
23
- - name : INPUT
24
- valueFrom :
25
- configMapKeyRef :
26
- name : calculateme-configmap
27
- key : calculateme
28
- command : ['sh']
29
- args : ["-c", "echo ${INPUT} | bc -l > '/tmp/index.html'"]
30
- volumeMounts :
31
- - mountPath : /tmp
32
- name : exch-vol
21
+ - name : bc
22
+ image : busybox
23
+ env :
24
+ - name : INPUT
25
+ valueFrom :
26
+ configMapKeyRef :
27
+ name : calculateme-configmap
28
+ key : calculateme
29
+ command : ['sh']
30
+ args : ["-c", "echo ${INPUT} | bc -l > '/tmp/index.html'"]
31
+ volumeMounts :
32
+ - mountPath : /tmp
33
+ name : exch-vol
33
34
volumes :
34
- - name : exch-vol
35
- persistentVolumeClaim :
36
- claimName : exch-vol
35
+ - name : exch-vol
36
+ persistentVolumeClaim :
37
+ claimName : exch-vol
Original file line number Diff line number Diff line change
1
+ ---
1
2
apiVersion : v1
2
3
kind : ConfigMap
3
4
metadata :
Original file line number Diff line number Diff line change
1
+ ---
1
2
apiVersion : v1
2
3
kind : PersistentVolumeClaim
3
4
metadata :
@@ -7,7 +8,7 @@ metadata:
7
8
name : exch-vol
8
9
spec :
9
10
accessModes :
10
- - ReadWriteOnce
11
+ - ReadWriteOnce
11
12
resources :
12
13
requests :
13
14
storage : 1Mi
Original file line number Diff line number Diff line change
1
+ ---
1
2
apiVersion : apps/v1
2
3
kind : Deployment
3
4
metadata :
@@ -15,26 +16,25 @@ spec:
15
16
app : output
16
17
spec :
17
18
containers :
18
- - name : output
19
- image : nginx
20
- volumeMounts :
21
- - mountPath : /usr/share/nginx/html/
22
- name : exch-vol
19
+ - name : output
20
+ image : nginx
21
+ volumeMounts :
22
+ - mountPath : /usr/share/nginx/html/
23
+ name : exch-vol
23
24
volumes :
24
- - name : exch-vol
25
- persistentVolumeClaim :
26
- claimName : exch-vol
25
+ - name : exch-vol
26
+ persistentVolumeClaim :
27
+ claimName : exch-vol
27
28
---
28
29
apiVersion : v1
29
30
kind : Service
30
31
metadata :
31
32
name : output-service
32
33
spec :
33
- type : NodePort
34
34
selector :
35
35
app : output
36
36
ports :
37
- - protocol : TCP
38
- port : 80
39
- targetPort : 80
40
- nodePort : 32000
37
+ # Default port used by the image (for Pod)
38
+ - targetPort : 80
39
+ # port on the Service
40
+ port : 5678
Original file line number Diff line number Diff line change
1
+ ---
2
+ apiVersion : networking.k8s.io/v1
3
+ kind : Ingress
4
+ metadata :
5
+ name : minimal-ingress
6
+ annotations :
7
+ # overcome the exposed URL in the backend service
8
+ nginx.ingress.kubernetes.io/rewrite-target : " /"
9
+ spec :
10
+ rules :
11
+ - http :
12
+ paths :
13
+ - pathType : Prefix
14
+ path : " /k8_calc"
15
+ backend :
16
+ service :
17
+ name : output-service
18
+ port :
19
+ number : 5678
Original file line number Diff line number Diff line change 1
- # for proper NodePort mapping
2
- # kind create cluster --config=./kind.yaml
3
- # https://stackoverflow.com/questions/62432961/how-to-use-nodeport-with-kind
4
- apiVersion : kind.x-k8s.io/v1alpha4
1
+ # from https://kind.sigs.k8s.io/docs/user/ingress/
2
+ ---
5
3
kind : Cluster
4
+ apiVersion : kind.x-k8s.io/v1alpha4
6
5
nodes :
7
- - role : control-plane
8
- extraPortMappings :
9
- - containerPort : 32000
10
- hostPort : 30000
11
- listenAddress : " 0.0.0.0" # Optional, defaults to "0.0.0.0"
12
- protocol : tcp # Optional, defaults to tcp
13
- - role : worker
6
+ - role : control-plane
7
+ kubeadmConfigPatches :
8
+ - |
9
+ kind: InitConfiguration
10
+ nodeRegistration:
11
+ kubeletExtraArgs:
12
+ node-labels: "ingress-ready=true"
13
+ extraPortMappings :
14
+ - containerPort : 80
15
+ hostPort : 80
16
+ protocol : TCP
17
+ - containerPort : 443
18
+ hostPort : 443
19
+ protocol : TCP
You can’t perform that action at this time.
0 commit comments