File tree Expand file tree Collapse file tree 30 files changed +147
-101
lines changed
03-installation-and-setup
04-built-in-resource-types
07-deploying-demo-application Expand file tree Collapse file tree 30 files changed +147
-101
lines changed Original file line number Diff line number Diff line change
1
+ XXXX
Original file line number Diff line number Diff line change
1
+ XXXX
Original file line number Diff line number Diff line change 14
14
spec :
15
15
containers :
16
16
- name : nginx
17
- image : nginx:1.26.0
17
+ # Change image tag then ReplicaSet will create new Pods
18
+ image : nginx:1.25.0
Original file line number Diff line number Diff line change @@ -28,8 +28,12 @@ tasks:
28
28
desc : " Roll the pods in one of the deployments"
29
29
cmds :
30
30
- kubectl rollout restart deployment nginx-better
31
+ # Switch to previous ReplicaSet
32
+
31
33
- watch "kubectl get pods"
32
34
35
+ # kubectl rollout undo deployment nginx-better
36
+
33
37
05-delete-namespace :
34
38
desc : " Delete the namespace to clean up"
35
39
cmds :
Original file line number Diff line number Diff line change 15
15
pathType : ImplementationSpecific
16
16
backend :
17
17
service :
18
- name : nginx-clusterip
18
+ name : nginx-nodeport
19
19
port :
20
20
number : 80
21
+ # kubectl run curl-pod -it --rm --image=curlimages/curl --command -- sh
22
+ # curl -H "Host: ingress-example-nginx.com" <node_ip>:<node_port>
23
+ # -H to specify the host header
24
+ # <node_ip>: is the IP of the node where the Ingress controller is running
25
+ # <node_port>: is the NodePort of the Ingress controller
Original file line number Diff line number Diff line change @@ -42,3 +42,18 @@ tasks:
42
42
- cmd : gum style "🚨 Deleting the namespace recursively deletes the resources inside of it! 🚨 "
43
43
silent : true
44
44
- kubectl delete -f Namespace.yaml
45
+ # Debug shell on a node => It create a debug pod on the node
46
+ # kubectl debug node/kind-worker2 -it --image=ubuntu
47
+
48
+ # Debug shell on a pod => It create a debug pod on the same node
49
+ # kubectl run curl-pod -it --rm --image=curlimages/curl --command -- sh
50
+ # curl <pod_ip>:<pod_port>
51
+ # curl <service_ip or service_name>:<service_port>
52
+ # eg: curl nginx-clusterip
53
+ # node_port defined in the service
54
+ # eg: curl <node_ip>:<node_port>
55
+
56
+ # kubectl run curl-pod -it --rm -n default --image=curlimages/curl --command -- sh
57
+ # outside namespace
58
+ # curl <service_name>.<namespace>.svc.cluster.local
59
+ # eg: curl nginx-clusterip.04--service.svc.cluster.local
Original file line number Diff line number Diff line change 34
34
silent : true
35
35
- helm registry login registry-1.docker.io
36
36
desc : Login to OCI registry
37
+ # sonthh98/<docker-hub_password>
37
38
38
39
05-list-registry :
39
40
cmds :
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ version: "3"
2
2
3
3
vars :
4
4
DATABASE_URL : " postgres://postgres:foobarbaz@localhost:5432/postgres"
5
- IMAGE_REPO : sidpalas /devops-directive-docker-course-api-golang
5
+ IMAGE_REPO : sonthh98 /devops-directive-docker-course-api-golang
6
6
IMAGE_TAG : foobarbaz
7
7
8
8
tasks :
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ version: "3"
2
2
3
3
vars :
4
4
DATABASE_URL : " postgres://postgres:foobarbaz@localhost:5432/postgres"
5
- IMAGE_REPO : sidpalas /devops-directive-docker-course-api-node
5
+ IMAGE_REPO : sonthh98 /devops-directive-docker-course-api-node
6
6
IMAGE_TAG : foobarbaz
7
7
8
8
tasks :
9
9
build-container-image :
10
10
desc : Build container image
11
11
cmds :
12
- - docker build -t {{.IMAGE_REPO}}{{.IMAGE_TAG}} .
12
+ - docker build -t {{.IMAGE_REPO}}: {{.IMAGE_TAG}} .
13
13
14
14
build-container-image-multi-arch :
15
15
desc : Build multi-arch container image
Original file line number Diff line number Diff line change 1
1
version : " 3"
2
2
3
3
vars :
4
- IMAGE_REPO : sidpalas /devops-directive-docker-course-client-react-nginx
4
+ IMAGE_REPO : sonthh98 /devops-directive-docker-course-client-react-nginx
5
5
IMAGE_TAG : foobarbaz
6
6
7
7
tasks :
Original file line number Diff line number Diff line change 1
1
version : " 3"
2
2
3
3
vars :
4
- IMAGE_REPO : sidpalas /devops-directive-kubernetes-course-load-generator-python
4
+ IMAGE_REPO : sonthh98 /devops-directive-kubernetes-course-load-generator-python
5
5
IMAGE_TAG : foobarbaz
6
6
7
7
tasks :
Original file line number Diff line number Diff line change 1
1
version : " 3"
2
2
3
3
vars :
4
- IMAGE_REPO : sidpalas /devops-directive-kubernetes-course-db-migrator
4
+ IMAGE_REPO : sonthh98 /devops-directive-kubernetes-course-db-migrator
5
5
IMAGE_TAG : foobarbaz
6
6
7
7
tasks :
Original file line number Diff line number Diff line change 17
17
spec :
18
18
containers :
19
19
- name : api-golang
20
- image : sidpalas /devops-directive-docker-course-api-golang:foobarbaz
20
+ image : sonthh98 /devops-directive-docker-course-api-golang:foobarbaz
21
21
env :
22
22
- name : PORT
23
23
value : " 8000"
Original file line number Diff line number Diff line change 1
- apiVersion : traefik.containo.us/v1alpha1
2
- kind : IngressRoute
3
- metadata :
4
- name : api-golang
5
- namespace : demo-app
6
- spec :
7
- entryPoints :
8
- - web
9
- routes :
10
- - kind : Rule
11
- match : Host(`kubernetes-course.devopsdirective.com`) && PathPrefix(`/api/golang`)
12
- middlewares :
13
- - name : strip-api-prefixes
14
- services :
15
- - kind : Service
16
- name : api-golang
17
- port : 8000
18
- scheme : http
1
+ # apiVersion: traefik.containo.us/v1alpha1
2
+ # kind: IngressRoute
3
+ # metadata:
4
+ # name: api-golang
5
+ # namespace: demo-app
6
+ # spec:
7
+ # entryPoints:
8
+ # - web
9
+ # routes:
10
+ # - kind: Rule
11
+ # match: Host(`kubernetes-course.devopsdirective.com`) && PathPrefix(`/api/golang`)
12
+ # middlewares:
13
+ # - name: strip-api-prefixes
14
+ # services:
15
+ # - kind: Service
16
+ # name: api-golang
17
+ # port: 8000
18
+ # scheme: http
Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ metadata:
6
6
name : api-golang-database-url
7
7
namespace : demo-app
8
8
stringData :
9
- DATABASE_URL : postgres://postgres:foobarbaz@postgres-postgresql.postgres .svc.cluster.local:5432/postgres
9
+ DATABASE_URL : postgres://postgres:foobarbaz@postgres-postgresql.postgresx .svc.cluster.local:5432/postgres
Original file line number Diff line number Diff line change 17
17
spec :
18
18
containers :
19
19
- name : api-node
20
- image : sidpalas /devops-directive-docker-course-api-node:foobarbaz
20
+ image : sonthh98 /devops-directive-docker-course-api-node:foobarbaz
21
21
env :
22
22
- name : PORT
23
23
value : " 3000"
Original file line number Diff line number Diff line change 1
- apiVersion : traefik.containo.us/v1alpha1
2
- kind : IngressRoute
3
- metadata :
4
- name : api-node
5
- namespace : demo-app
6
- spec :
7
- entryPoints :
8
- - web
9
- routes :
10
- - kind : Rule
11
- match : Host(`kubernetes-course.devopsdirective.com`) && PathPrefix(`/api/node`)
12
- middlewares :
13
- - name : strip-api-prefixes
14
- services :
15
- - kind : Service
16
- name : api-node
17
- port : 3000
18
- scheme : http
1
+ # apiVersion: traefik.containo.us/v1alpha1
2
+ # kind: IngressRoute
3
+ # metadata:
4
+ # name: api-node
5
+ # namespace: demo-app
6
+ # spec:
7
+ # entryPoints:
8
+ # - web
9
+ # routes:
10
+ # - kind: Rule
11
+ # match: Host(`kubernetes-course.devopsdirective.com`) && PathPrefix(`/api/node`)
12
+ # middlewares:
13
+ # - name: strip-api-prefixes
14
+ # services:
15
+ # - kind: Service
16
+ # name: api-node
17
+ # port: 3000
18
+ # scheme: http
Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ metadata:
6
6
name : api-node-database-url
7
7
namespace : demo-app
8
8
stringData :
9
- DATABASE_URL : postgres://postgres:foobarbaz@postgres-postgresql.postgres .svc.cluster.local:5432/postgres
9
+ DATABASE_URL : postgres://postgres:foobarbaz@postgres-postgresql.postgresx .svc.cluster.local:5432/postgres
Original file line number Diff line number Diff line change 13
13
add_header 'Content-Type' 'text/plain';
14
14
return 200 "pong";
15
15
}
16
-
16
+ location /api/golang/ {
17
+ proxy_set_header X-Forwarded-Host $host;
18
+ proxy_set_header X-Forwarded-Server $host;
19
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
20
+ proxy_http_version 1.1;
21
+
22
+ rewrite ^/api-golang/(.*) /$1 break;
23
+ proxy_pass http://api-golang:8000/;
24
+ }
25
+ location /api/node/ {
26
+ proxy_set_header X-Forwarded-Host $host;
27
+ proxy_set_header X-Forwarded-Server $host;
28
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
29
+ proxy_http_version 1.1;
30
+
31
+ rewrite ^/api/node/(.*) /$1 break;
32
+ proxy_pass http://api-node:3000/;
33
+ }
17
34
location / {
18
35
root /usr/share/nginx/html;
19
36
index index.html index.htm;
Original file line number Diff line number Diff line change 16
16
app : client-react-nginx
17
17
spec :
18
18
containers :
19
- - image : sidpalas /devops-directive-docker-course-client-react-nginx:foobarbaz
19
+ - image : sonthh98 /devops-directive-docker-course-client-react-nginx:foobarbaz
20
20
name : client-react-nginx
21
21
ports :
22
22
- containerPort : 8080
Original file line number Diff line number Diff line change 1
- apiVersion : traefik.containo.us/v1alpha1
2
- kind : IngressRoute
3
- metadata :
4
- name : client-react-nginx
5
- namespace : demo-app
6
- spec :
7
- entryPoints :
8
- - web
9
- routes :
10
- - kind : Rule
11
- match : Host(`kubernetes-course.devopsdirective.com`)
12
- services :
13
- - kind : Service
14
- name : client-react-nginx
15
- port : 8080
16
- scheme : http
1
+ # apiVersion: traefik.containo.us/v1alpha1
2
+ # kind: IngressRoute
3
+ # metadata:
4
+ # name: client-react-nginx
5
+ # namespace: demo-app
6
+ # spec:
7
+ # entryPoints:
8
+ # - web
9
+ # routes:
10
+ # - kind: Rule
11
+ # match: Host(`kubernetes-course.devopsdirective.com`)
12
+ # services:
13
+ # - kind: Service
14
+ # name: client-react-nginx
15
+ # port: 8080
16
+ # scheme: http
Original file line number Diff line number Diff line change 1
- apiVersion : traefik.containo.us/v1alpha1
2
- kind : Middleware
3
- metadata :
4
- name : strip-api-prefixes
5
- namespace : demo-app
6
- spec :
7
- stripPrefix :
8
- forceSlash : false
9
- prefixes :
10
- - /api/node
11
- - /api/golang
1
+ # apiVersion: traefik.containo.us/v1alpha1
2
+ # kind: Middleware
3
+ # metadata:
4
+ # name: strip-api-prefixes
5
+ # namespace: demo-app
6
+ # spec:
7
+ # stripPrefix:
8
+ # forceSlash: false
9
+ # prefixes:
10
+ # - /api/node
11
+ # - /api/golang
Original file line number Diff line number Diff line change 7
7
- kubectl apply -f Namespace.yaml
8
8
- kubens demo-app
9
9
10
- deploy-traefik :
11
- desc : " Deploy Traefik using Helm"
12
- cmds :
13
- - helm repo add traefik https://traefik.github.io/charts
14
- - helm upgrade --install -n traefik --create-namespace traefik traefik/traefik --version 20.8.0
10
+ # deploy-traefik:
11
+ # desc: "Deploy Traefik using Helm"
12
+ # cmds:
13
+ # - helm repo add traefik https://traefik.github.io/charts
14
+ # - helm upgrade --install -n traefik --create-namespace traefik traefik/traefik --version 20.8.0
15
15
16
- apply-traefik-middleware :
17
- desc : " Deploy Traefik middleware"
18
- cmds :
19
- - " kubectl apply -f Middleware.yaml"
16
+ # apply-traefik-middleware:
17
+ # desc: "Deploy Traefik middleware"
18
+ # cmds:
19
+ # - "kubectl apply -f Middleware.yaml"
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ metadata:
6
6
name : load-generator-config
7
7
namespace : demo-app
8
8
data :
9
- API_URL : http://api-node.demo-app.svc.cluster.local:3000
10
- # API_URL: http://api-golang.demo-app.svc.cluster.local:8080
9
+ # API_URL: http://api-node.demo-app.svc.cluster.local:3000
10
+ API_URL : http://api-golang.demo-app.svc.cluster.local:8080
11
11
DELAY_MS : " 100"
Original file line number Diff line number Diff line change @@ -17,17 +17,17 @@ spec:
17
17
spec :
18
18
containers :
19
19
- name : load-generator
20
- image : sidpalas /devops-directive-kubernetes-course-load-generator-python:foobarbaz
20
+ image : sonthh98 /devops-directive-kubernetes-course-load-generator-python:foobarbaz
21
21
imagePullPolicy : Always
22
- env :
23
- - name : API_URL
24
- value : http://api-node.demo-app.svc.cluster.local:3000
25
- - name : DELAY_MS
26
- value : " 500"
22
+ # env:
23
+ # - name: API_URL
24
+ # value: http://api-node.demo-app.svc.cluster.local:3000
25
+ # - name: DELAY_MS
26
+ # value: "500"
27
27
# Could alternatively move these to a configmap
28
- # envFrom:
29
- # - configMapRef:
30
- # name: load-generator-config
28
+ envFrom :
29
+ - configMapRef :
30
+ name : load-generator-config
31
31
resources :
32
32
limits :
33
33
memory : " 50Mi"
Original file line number Diff line number Diff line change 8
8
spec :
9
9
containers :
10
10
- name : migrate
11
- image : sidpalas /devops-directive-kubernetes-course-db-migrator:foobarbaz
11
+ image : sonthh98 /devops-directive-kubernetes-course-db-migrator:foobarbaz
12
12
args :
13
13
- -path=/app/migrations
14
14
- -database=$(DATABASE_URL)?sslmode=disable
Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ metadata:
6
6
namespace : demo-app
7
7
type : Opaque
8
8
stringData :
9
- DATABASE_URL :
postgres://postgres:[email protected] :5432/postgres
9
+ DATABASE_URL :
postgres://postgres:[email protected] :5432/postgres
10
+ # cat /etc/resolv.conf in Postgres pod to get the cluster DNS suffix
Original file line number Diff line number Diff line change 7
7
- helm repo add bitnami https://charts.bitnami.com/bitnami
8
8
- |
9
9
helm upgrade --install \
10
- -n postgres \
10
+ -n postgresx \
11
11
postgres bitnami/postgresql \
12
12
--set auth.postgresPassword=foobarbaz \
13
13
--version 15.3.2 \
You can’t perform that action at this time.
0 commit comments