diff --git a/03-installation-and-setup/kind-bind-mount-1/test.cc b/03-installation-and-setup/kind-bind-mount-1/test.cc new file mode 100644 index 0000000..d71e24d --- /dev/null +++ b/03-installation-and-setup/kind-bind-mount-1/test.cc @@ -0,0 +1 @@ +XXXX \ No newline at end of file diff --git a/03-installation-and-setup/kind-bind-mount-2/test.xx b/03-installation-and-setup/kind-bind-mount-2/test.xx new file mode 100644 index 0000000..d71e24d --- /dev/null +++ b/03-installation-and-setup/kind-bind-mount-2/test.xx @@ -0,0 +1 @@ +XXXX \ No newline at end of file diff --git a/03-installation-and-setup/kind-bind-mount-2/test2.xx b/03-installation-and-setup/kind-bind-mount-2/test2.xx new file mode 100644 index 0000000..e69de29 diff --git a/04-built-in-resource-types/Deployment/Deployment.nginx-minimal.yaml b/04-built-in-resource-types/Deployment/Deployment.nginx-minimal.yaml index bdfa6a1..eeb41c6 100644 --- a/04-built-in-resource-types/Deployment/Deployment.nginx-minimal.yaml +++ b/04-built-in-resource-types/Deployment/Deployment.nginx-minimal.yaml @@ -14,4 +14,5 @@ spec: spec: containers: - name: nginx - image: nginx:1.26.0 + # Change image tag then ReplicaSet will create new Pods + image: nginx:1.25.0 diff --git a/04-built-in-resource-types/Deployment/Taskfile.yaml b/04-built-in-resource-types/Deployment/Taskfile.yaml index e245bca..dce8f4f 100644 --- a/04-built-in-resource-types/Deployment/Taskfile.yaml +++ b/04-built-in-resource-types/Deployment/Taskfile.yaml @@ -28,8 +28,12 @@ tasks: desc: "Roll the pods in one of the deployments" cmds: - kubectl rollout restart deployment nginx-better + # Switch to previous ReplicaSet + - watch "kubectl get pods" + # kubectl rollout undo deployment nginx-better + 05-delete-namespace: desc: "Delete the namespace to clean up" cmds: diff --git a/04-built-in-resource-types/Ingress/Ingress.minimal-nginx.yaml b/04-built-in-resource-types/Ingress/Ingress.minimal-nginx.yaml index 48cb26d..63eaab8 100644 --- a/04-built-in-resource-types/Ingress/Ingress.minimal-nginx.yaml +++ b/04-built-in-resource-types/Ingress/Ingress.minimal-nginx.yaml @@ -15,6 +15,11 @@ spec: pathType: ImplementationSpecific backend: service: - name: nginx-clusterip + name: nginx-nodeport port: number: 80 +# kubectl run curl-pod -it --rm --image=curlimages/curl --command -- sh +# curl -H "Host: ingress-example-nginx.com" : +# -H to specify the host header +# : is the IP of the node where the Ingress controller is running +# : is the NodePort of the Ingress controller diff --git a/04-built-in-resource-types/Service/Taskfile.yaml b/04-built-in-resource-types/Service/Taskfile.yaml index 7dc258e..4a54b27 100644 --- a/04-built-in-resource-types/Service/Taskfile.yaml +++ b/04-built-in-resource-types/Service/Taskfile.yaml @@ -42,3 +42,18 @@ tasks: - cmd: gum style "🚨 Deleting the namespace recursively deletes the resources inside of it! 🚨 " silent: true - kubectl delete -f Namespace.yaml +# Debug shell on a node => It create a debug pod on the node +# kubectl debug node/kind-worker2 -it --image=ubuntu + +# Debug shell on a pod => It create a debug pod on the same node +# kubectl run curl-pod -it --rm --image=curlimages/curl --command -- sh +# curl : +# curl : +# eg: curl nginx-clusterip +# node_port defined in the service +# eg: curl : + +# kubectl run curl-pod -it --rm -n default --image=curlimages/curl --command -- sh +# outside namespace +# curl ..svc.cluster.local +# eg: curl nginx-clusterip.04--service.svc.cluster.local diff --git a/05-helm/postgresql/Taskfile.yaml b/05-helm/postgresql/Taskfile.yaml index 4b6cba2..704095b 100644 --- a/05-helm/postgresql/Taskfile.yaml +++ b/05-helm/postgresql/Taskfile.yaml @@ -34,6 +34,7 @@ tasks: silent: true - helm registry login registry-1.docker.io desc: Login to OCI registry + # sonthh98/ 05-list-registry: cmds: diff --git a/06-demo-application/api-golang/Taskfile.yaml b/06-demo-application/api-golang/Taskfile.yaml index 0209a40..a81eccf 100644 --- a/06-demo-application/api-golang/Taskfile.yaml +++ b/06-demo-application/api-golang/Taskfile.yaml @@ -2,7 +2,7 @@ version: "3" vars: DATABASE_URL: "postgres://postgres:foobarbaz@localhost:5432/postgres" - IMAGE_REPO: sidpalas/devops-directive-docker-course-api-golang + IMAGE_REPO: sonthh98/devops-directive-docker-course-api-golang IMAGE_TAG: foobarbaz tasks: diff --git a/06-demo-application/api-node/Taskfile.yaml b/06-demo-application/api-node/Taskfile.yaml index ad37cd5..45d5b1a 100644 --- a/06-demo-application/api-node/Taskfile.yaml +++ b/06-demo-application/api-node/Taskfile.yaml @@ -2,14 +2,14 @@ version: "3" vars: DATABASE_URL: "postgres://postgres:foobarbaz@localhost:5432/postgres" - IMAGE_REPO: sidpalas/devops-directive-docker-course-api-node + IMAGE_REPO: sonthh98/devops-directive-docker-course-api-node IMAGE_TAG: foobarbaz tasks: build-container-image: desc: Build container image cmds: - - docker build -t {{.IMAGE_REPO}}{{.IMAGE_TAG}} . + - docker build -t {{.IMAGE_REPO}}:{{.IMAGE_TAG}} . build-container-image-multi-arch: desc: Build multi-arch container image diff --git a/06-demo-application/client-react/Taskfile.yaml b/06-demo-application/client-react/Taskfile.yaml index 0764f93..bc95ff1 100644 --- a/06-demo-application/client-react/Taskfile.yaml +++ b/06-demo-application/client-react/Taskfile.yaml @@ -1,7 +1,7 @@ version: "3" vars: - IMAGE_REPO: sidpalas/devops-directive-docker-course-client-react-nginx + IMAGE_REPO: sonthh98/devops-directive-docker-course-client-react-nginx IMAGE_TAG: foobarbaz tasks: diff --git a/06-demo-application/load-generator-python/Taskfile.yaml b/06-demo-application/load-generator-python/Taskfile.yaml index 54d70fb..82b9237 100644 --- a/06-demo-application/load-generator-python/Taskfile.yaml +++ b/06-demo-application/load-generator-python/Taskfile.yaml @@ -1,7 +1,7 @@ version: "3" vars: - IMAGE_REPO: sidpalas/devops-directive-kubernetes-course-load-generator-python + IMAGE_REPO: sonthh98/devops-directive-kubernetes-course-load-generator-python IMAGE_TAG: foobarbaz tasks: diff --git a/06-demo-application/postgresql/Taskfile.yaml b/06-demo-application/postgresql/Taskfile.yaml index 028cfbb..ad59985 100644 --- a/06-demo-application/postgresql/Taskfile.yaml +++ b/06-demo-application/postgresql/Taskfile.yaml @@ -1,7 +1,7 @@ version: "3" vars: - IMAGE_REPO: sidpalas/devops-directive-kubernetes-course-db-migrator + IMAGE_REPO: sonthh98/devops-directive-kubernetes-course-db-migrator IMAGE_TAG: foobarbaz tasks: diff --git a/07-deploying-demo-application/api-golang/Deployment.yaml b/07-deploying-demo-application/api-golang/Deployment.yaml index bb62399..c80f527 100644 --- a/07-deploying-demo-application/api-golang/Deployment.yaml +++ b/07-deploying-demo-application/api-golang/Deployment.yaml @@ -17,7 +17,7 @@ spec: spec: containers: - name: api-golang - image: sidpalas/devops-directive-docker-course-api-golang:foobarbaz + image: sonthh98/devops-directive-docker-course-api-golang:foobarbaz env: - name: PORT value: "8000" diff --git a/07-deploying-demo-application/api-golang/IngressRoute.yaml b/07-deploying-demo-application/api-golang/IngressRoute.yaml index 7fae3ef..95537af 100644 --- a/07-deploying-demo-application/api-golang/IngressRoute.yaml +++ b/07-deploying-demo-application/api-golang/IngressRoute.yaml @@ -1,18 +1,18 @@ -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: api-golang - namespace: demo-app -spec: - entryPoints: - - web - routes: - - kind: Rule - match: Host(`kubernetes-course.devopsdirective.com`) && PathPrefix(`/api/golang`) - middlewares: - - name: strip-api-prefixes - services: - - kind: Service - name: api-golang - port: 8000 - scheme: http +# apiVersion: traefik.containo.us/v1alpha1 +# kind: IngressRoute +# metadata: +# name: api-golang +# namespace: demo-app +# spec: +# entryPoints: +# - web +# routes: +# - kind: Rule +# match: Host(`kubernetes-course.devopsdirective.com`) && PathPrefix(`/api/golang`) +# middlewares: +# - name: strip-api-prefixes +# services: +# - kind: Service +# name: api-golang +# port: 8000 +# scheme: http diff --git a/07-deploying-demo-application/api-golang/Secret.yml b/07-deploying-demo-application/api-golang/Secret.yml index c379450..4216104 100644 --- a/07-deploying-demo-application/api-golang/Secret.yml +++ b/07-deploying-demo-application/api-golang/Secret.yml @@ -6,4 +6,4 @@ metadata: name: api-golang-database-url namespace: demo-app stringData: - DATABASE_URL: postgres://postgres:foobarbaz@postgres-postgresql.postgres.svc.cluster.local:5432/postgres + DATABASE_URL: postgres://postgres:foobarbaz@postgres-postgresql.postgresx.svc.cluster.local:5432/postgres diff --git a/07-deploying-demo-application/api-node/Deployment.yaml b/07-deploying-demo-application/api-node/Deployment.yaml index f61975d..4b24341 100644 --- a/07-deploying-demo-application/api-node/Deployment.yaml +++ b/07-deploying-demo-application/api-node/Deployment.yaml @@ -17,7 +17,7 @@ spec: spec: containers: - name: api-node - image: sidpalas/devops-directive-docker-course-api-node:foobarbaz + image: sonthh98/devops-directive-docker-course-api-node:foobarbaz env: - name: PORT value: "3000" diff --git a/07-deploying-demo-application/api-node/IngressRoute.yaml b/07-deploying-demo-application/api-node/IngressRoute.yaml index 17f6901..e2b46f2 100644 --- a/07-deploying-demo-application/api-node/IngressRoute.yaml +++ b/07-deploying-demo-application/api-node/IngressRoute.yaml @@ -1,18 +1,18 @@ -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: api-node - namespace: demo-app -spec: - entryPoints: - - web - routes: - - kind: Rule - match: Host(`kubernetes-course.devopsdirective.com`) && PathPrefix(`/api/node`) - middlewares: - - name: strip-api-prefixes - services: - - kind: Service - name: api-node - port: 3000 - scheme: http +# apiVersion: traefik.containo.us/v1alpha1 +# kind: IngressRoute +# metadata: +# name: api-node +# namespace: demo-app +# spec: +# entryPoints: +# - web +# routes: +# - kind: Rule +# match: Host(`kubernetes-course.devopsdirective.com`) && PathPrefix(`/api/node`) +# middlewares: +# - name: strip-api-prefixes +# services: +# - kind: Service +# name: api-node +# port: 3000 +# scheme: http diff --git a/07-deploying-demo-application/api-node/Secret.yaml b/07-deploying-demo-application/api-node/Secret.yaml index 46587d2..441957b 100644 --- a/07-deploying-demo-application/api-node/Secret.yaml +++ b/07-deploying-demo-application/api-node/Secret.yaml @@ -6,4 +6,4 @@ metadata: name: api-node-database-url namespace: demo-app stringData: - DATABASE_URL: postgres://postgres:foobarbaz@postgres-postgresql.postgres.svc.cluster.local:5432/postgres + DATABASE_URL: postgres://postgres:foobarbaz@postgres-postgresql.postgresx.svc.cluster.local:5432/postgres diff --git a/07-deploying-demo-application/client-react/ConfigMap.yaml b/07-deploying-demo-application/client-react/ConfigMap.yaml index c37b9e0..1122925 100644 --- a/07-deploying-demo-application/client-react/ConfigMap.yaml +++ b/07-deploying-demo-application/client-react/ConfigMap.yaml @@ -13,7 +13,24 @@ data: add_header 'Content-Type' 'text/plain'; return 200 "pong"; } - + location /api/golang/ { + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_http_version 1.1; + + rewrite ^/api-golang/(.*) /$1 break; + proxy_pass http://api-golang:8000/; + } + location /api/node/ { + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_http_version 1.1; + + rewrite ^/api/node/(.*) /$1 break; + proxy_pass http://api-node:3000/; + } location / { root /usr/share/nginx/html; index index.html index.htm; diff --git a/07-deploying-demo-application/client-react/Deployment.yaml b/07-deploying-demo-application/client-react/Deployment.yaml index b5ec231..ad27cef 100644 --- a/07-deploying-demo-application/client-react/Deployment.yaml +++ b/07-deploying-demo-application/client-react/Deployment.yaml @@ -16,7 +16,7 @@ spec: app: client-react-nginx spec: containers: - - image: sidpalas/devops-directive-docker-course-client-react-nginx:foobarbaz + - image: sonthh98/devops-directive-docker-course-client-react-nginx:foobarbaz name: client-react-nginx ports: - containerPort: 8080 diff --git a/07-deploying-demo-application/client-react/IngressRoute.yaml b/07-deploying-demo-application/client-react/IngressRoute.yaml index 85b7640..2165cd6 100644 --- a/07-deploying-demo-application/client-react/IngressRoute.yaml +++ b/07-deploying-demo-application/client-react/IngressRoute.yaml @@ -1,16 +1,16 @@ -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: client-react-nginx - namespace: demo-app -spec: - entryPoints: - - web - routes: - - kind: Rule - match: Host(`kubernetes-course.devopsdirective.com`) - services: - - kind: Service - name: client-react-nginx - port: 8080 - scheme: http +# apiVersion: traefik.containo.us/v1alpha1 +# kind: IngressRoute +# metadata: +# name: client-react-nginx +# namespace: demo-app +# spec: +# entryPoints: +# - web +# routes: +# - kind: Rule +# match: Host(`kubernetes-course.devopsdirective.com`) +# services: +# - kind: Service +# name: client-react-nginx +# port: 8080 +# scheme: http diff --git a/07-deploying-demo-application/common/Middleware.yaml b/07-deploying-demo-application/common/Middleware.yaml index f11660c..32bc2bb 100644 --- a/07-deploying-demo-application/common/Middleware.yaml +++ b/07-deploying-demo-application/common/Middleware.yaml @@ -1,11 +1,11 @@ -apiVersion: traefik.containo.us/v1alpha1 -kind: Middleware -metadata: - name: strip-api-prefixes - namespace: demo-app -spec: - stripPrefix: - forceSlash: false - prefixes: - - /api/node - - /api/golang +# apiVersion: traefik.containo.us/v1alpha1 +# kind: Middleware +# metadata: +# name: strip-api-prefixes +# namespace: demo-app +# spec: +# stripPrefix: +# forceSlash: false +# prefixes: +# - /api/node +# - /api/golang diff --git a/07-deploying-demo-application/common/Taskfile.yaml b/07-deploying-demo-application/common/Taskfile.yaml index e4bf812..8767da6 100644 --- a/07-deploying-demo-application/common/Taskfile.yaml +++ b/07-deploying-demo-application/common/Taskfile.yaml @@ -7,13 +7,13 @@ tasks: - kubectl apply -f Namespace.yaml - kubens demo-app - deploy-traefik: - desc: "Deploy Traefik using Helm" - cmds: - - helm repo add traefik https://traefik.github.io/charts - - helm upgrade --install -n traefik --create-namespace traefik traefik/traefik --version 20.8.0 + # deploy-traefik: + # desc: "Deploy Traefik using Helm" + # cmds: + # - helm repo add traefik https://traefik.github.io/charts + # - helm upgrade --install -n traefik --create-namespace traefik traefik/traefik --version 20.8.0 - apply-traefik-middleware: - desc: "Deploy Traefik middleware" - cmds: - - "kubectl apply -f Middleware.yaml" + # apply-traefik-middleware: + # desc: "Deploy Traefik middleware" + # cmds: + # - "kubectl apply -f Middleware.yaml" diff --git a/07-deploying-demo-application/load-generator-python/ConfigMap.yaml b/07-deploying-demo-application/load-generator-python/ConfigMap.yaml index d042fe3..dd0a5df 100644 --- a/07-deploying-demo-application/load-generator-python/ConfigMap.yaml +++ b/07-deploying-demo-application/load-generator-python/ConfigMap.yaml @@ -6,6 +6,6 @@ metadata: name: load-generator-config namespace: demo-app data: - API_URL: http://api-node.demo-app.svc.cluster.local:3000 - # API_URL: http://api-golang.demo-app.svc.cluster.local:8080 + # API_URL: http://api-node.demo-app.svc.cluster.local:3000 + API_URL: http://api-golang.demo-app.svc.cluster.local:8080 DELAY_MS: "100" diff --git a/07-deploying-demo-application/load-generator-python/Deployment.yaml b/07-deploying-demo-application/load-generator-python/Deployment.yaml index 55196f2..4b1dca9 100644 --- a/07-deploying-demo-application/load-generator-python/Deployment.yaml +++ b/07-deploying-demo-application/load-generator-python/Deployment.yaml @@ -17,17 +17,17 @@ spec: spec: containers: - name: load-generator - image: sidpalas/devops-directive-kubernetes-course-load-generator-python:foobarbaz + image: sonthh98/devops-directive-kubernetes-course-load-generator-python:foobarbaz imagePullPolicy: Always - env: - - name: API_URL - value: http://api-node.demo-app.svc.cluster.local:3000 - - name: DELAY_MS - value: "500" + # env: + # - name: API_URL + # value: http://api-node.demo-app.svc.cluster.local:3000 + # - name: DELAY_MS + # value: "500" # Could alternatively move these to a configmap - # envFrom: - # - configMapRef: - # name: load-generator-config + envFrom: + - configMapRef: + name: load-generator-config resources: limits: memory: "50Mi" diff --git a/07-deploying-demo-application/postgresql/Job.db-migrator.yaml b/07-deploying-demo-application/postgresql/Job.db-migrator.yaml index 07f2f8c..8effd0c 100644 --- a/07-deploying-demo-application/postgresql/Job.db-migrator.yaml +++ b/07-deploying-demo-application/postgresql/Job.db-migrator.yaml @@ -8,7 +8,7 @@ spec: spec: containers: - name: migrate - image: sidpalas/devops-directive-kubernetes-course-db-migrator:foobarbaz + image: sonthh98/devops-directive-kubernetes-course-db-migrator:foobarbaz args: - -path=/app/migrations - -database=$(DATABASE_URL)?sslmode=disable diff --git a/07-deploying-demo-application/postgresql/Secret.db-password.yaml b/07-deploying-demo-application/postgresql/Secret.db-password.yaml index c41d862..a48283a 100644 --- a/07-deploying-demo-application/postgresql/Secret.db-password.yaml +++ b/07-deploying-demo-application/postgresql/Secret.db-password.yaml @@ -6,4 +6,5 @@ metadata: namespace: demo-app type: Opaque stringData: - DATABASE_URL: postgres://postgres:foobarbaz@postgres-postgresql.postgres.svc.cluster.local:5432/postgres + DATABASE_URL: postgres://postgres:foobarbaz@postgres-postgresql.postgresx.svc.cluster.local:5432/postgres + # cat /etc/resolv.conf in Postgres pod to get the cluster DNS suffix diff --git a/07-deploying-demo-application/postgresql/Taskfile.yaml b/07-deploying-demo-application/postgresql/Taskfile.yaml index 62b87aa..ebfa95d 100644 --- a/07-deploying-demo-application/postgresql/Taskfile.yaml +++ b/07-deploying-demo-application/postgresql/Taskfile.yaml @@ -7,7 +7,7 @@ tasks: - helm repo add bitnami https://charts.bitnami.com/bitnami - | helm upgrade --install \ - -n postgres \ + -n postgresx \ postgres bitnami/postgresql \ --set auth.postgresPassword=foobarbaz \ --version 15.3.2 \ diff --git a/devbox.lock b/devbox.lock index 13ba1cf..314bb5a 100644 --- a/devbox.lock +++ b/devbox.lock @@ -1117,7 +1117,7 @@ }, "python312@latest": { "last_modified": "2024-05-22T06:18:38Z", - "plugin_version": "0.0.3", + "plugin_version": "0.0.4", "resolved": "github:NixOS/nixpkgs/3f316d2a50699a78afe5e77ca486ad553169061e#python312", "source": "devbox-search", "version": "3.12.3",