From 9d56b7f70672a349d17775f0f36a4ec12fc64d98 Mon Sep 17 00:00:00 2001 From: Maciej Wal <1977132+Xata@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:33:08 -0600 Subject: [PATCH 1/4] test Signed-off-by: Maciej Wal <1977132+Xata@users.noreply.github.com> --- README.md | 7 +++++++ argocd/application.yaml | 4 +++- infra/cert-manager/clusterissuer.yaml | 2 +- k8s/argocd-httproute.yaml | 2 +- k8s/certificate.yaml | 2 +- k8s/deployment.yaml | 2 +- k8s/gateway.yaml | 2 +- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f7758b7..45b8bda 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,13 @@ helm install eg oci://docker.io/envoyproxy/gateway-helm \ kubectl apply -f infra/envoy-gateway/gatewayclass.yaml ``` +You can verify that Envoy Gateway is working by running: + +```bash +kubectl get pods -n envoy-gateway-system +kubectl get gatewayclass eg +``` + 2. Install cert-manager: ```bash diff --git a/argocd/application.yaml b/argocd/application.yaml index 3f371b9..a04b874 100644 --- a/argocd/application.yaml +++ b/argocd/application.yaml @@ -7,7 +7,9 @@ spec: project: default source: # Replace with your GitHub username. - repoURL: https://github.com//msud-cmute-gitops-workshop.git + repoURL: https://github.com/xata/msud-cmute-gitops-workshop.git + # Replace main with your branch if you made a specific branch + # You will have to update the CI workflow to use the branch targetRevision: main path: k8s destination: diff --git a/infra/cert-manager/clusterissuer.yaml b/infra/cert-manager/clusterissuer.yaml index c3593bb..5e686eb 100644 --- a/infra/cert-manager/clusterissuer.yaml +++ b/infra/cert-manager/clusterissuer.yaml @@ -5,7 +5,7 @@ metadata: spec: acme: server: https://acme-v02.api.letsencrypt.org/directory - email: + email: mwal@msudenver.edu privateKeySecretRef: name: letsencrypt-do solvers: diff --git a/k8s/argocd-httproute.yaml b/k8s/argocd-httproute.yaml index 69d8fcd..549fe0e 100644 --- a/k8s/argocd-httproute.yaml +++ b/k8s/argocd-httproute.yaml @@ -9,7 +9,7 @@ spec: namespace: paper sectionName: argocd-https hostnames: - - argocd..mc.labs.cmute.cloud + - argocd.test.mc.labs.cmute.cloud rules: - backendRefs: - name: argocd-server diff --git a/k8s/certificate.yaml b/k8s/certificate.yaml index 9550416..d1dc2fb 100644 --- a/k8s/certificate.yaml +++ b/k8s/certificate.yaml @@ -22,7 +22,7 @@ spec: # to terminate TLS for the ArgoCD UI. secretName: argocd-tls dnsNames: - - argocd..mc.labs.cmute.cloud + - argocd.test.mc.labs.cmute.cloud issuerRef: name: letsencrypt-do kind: ClusterIssuer diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index e0c09d2..17bfc17 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -21,7 +21,7 @@ spec: containers: - name: paper # MAKE SURE THIS IS LOWERCASE OTHERWISE YOU'LL GET AN ERROR :) - image: ghcr.io//msud-cmute-gitops-workshop:latest + image: ghcr.io/xata/msud-cmute-gitops-workshop:latest ports: - containerPort: 25565 resources: diff --git a/k8s/gateway.yaml b/k8s/gateway.yaml index d2d98ae..b7d6b10 100644 --- a/k8s/gateway.yaml +++ b/k8s/gateway.yaml @@ -14,7 +14,7 @@ spec: - name: argocd-https protocol: HTTPS port: 443 - hostname: argocd..mc.labs.cmute.cloud + hostname: argocd.test.mc.labs.cmute.cloud tls: mode: Terminate certificateRefs: From 2dee3257c0907815dda4076702249c77071f7d5c Mon Sep 17 00:00:00 2001 From: Maciej Wal <1977132+Xata@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:39:11 -0600 Subject: [PATCH 2/4] test2 Signed-off-by: Maciej Wal <1977132+Xata@users.noreply.github.com> --- argocd/application.yaml | 2 +- k8s/certificate.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/argocd/application.yaml b/argocd/application.yaml index a04b874..6afbabf 100644 --- a/argocd/application.yaml +++ b/argocd/application.yaml @@ -10,7 +10,7 @@ spec: repoURL: https://github.com/xata/msud-cmute-gitops-workshop.git # Replace main with your branch if you made a specific branch # You will have to update the CI workflow to use the branch - targetRevision: main + targetRevision: test path: k8s destination: server: https://kubernetes.default.svc diff --git a/k8s/certificate.yaml b/k8s/certificate.yaml index d1dc2fb..084382d 100644 --- a/k8s/certificate.yaml +++ b/k8s/certificate.yaml @@ -8,7 +8,7 @@ spec: # to demonstrate the cert-manager + DNS-01 flow end to end. secretName: paper-tls dnsNames: - - .mc.labs.cmute.cloud + - test.mc.labs.cmute.cloud issuerRef: name: letsencrypt-do kind: ClusterIssuer From 34196432b6de42cc595114fc6af0d2e897c30bde Mon Sep 17 00:00:00 2001 From: Maciej Wal <1977132+Xata@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:45:39 -0600 Subject: [PATCH 3/4] test3 Signed-off-by: Maciej Wal <1977132+Xata@users.noreply.github.com> --- k8s/configmap.yaml | 2 +- k8s/deployment.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s/configmap.yaml b/k8s/configmap.yaml index f8956fd..2fae567 100644 --- a/k8s/configmap.yaml +++ b/k8s/configmap.yaml @@ -5,7 +5,7 @@ metadata: data: server.properties: | server-port=25565 - motd=A Minecraft Server on k8s + motd=A GitOps Minecraft Server on k8s max-players=3 # online-mode=false lets any Minecraft client connect without a Mojang # account check. This is fine for a workshop, but never use it on a diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 17bfc17..332b8a3 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -14,7 +14,7 @@ spec: labels: app: paper annotations: - configmap-hash: "1" + configmap-hash: "2" spec: securityContext: fsGroup: 1000 From 0cf4fe9d86dd3774a09c5de14ccda87f05fcdf98 Mon Sep 17 00:00:00 2001 From: Maciej Wal <1977132+Xata@users.noreply.github.com> Date: Mon, 20 Jul 2026 13:00:03 -0600 Subject: [PATCH 4/4] revert test changes Signed-off-by: Maciej Wal <1977132+Xata@users.noreply.github.com> --- README.md | 91 ++++++++++++++++++++------- argocd/application.yaml | 4 +- infra/cert-manager/clusterissuer.yaml | 2 +- infra/tofu/terraform.tfvars.example | 2 +- k8s/argocd-httproute.yaml | 2 +- k8s/certificate.yaml | 8 +-- k8s/configmap.yaml | 2 +- k8s/deployment.yaml | 5 +- k8s/gateway.yaml | 2 +- 9 files changed, 82 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 45b8bda..08ba51a 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,10 @@ Deploy a PaperMC Minecraft server to DigitalOcean Kubernetes using GitOps princi - A DigitalOcean API token ### Note About Minecraft Version -**Note:** The server runs Minecraft **1.21.11**. -In the Minecraft Launcher, create an installation for version 1.21.11 (Installations → New installation) and use it to connect, the latest client version will not join a 1.21.11 server. +**Note:** The server runs Minecraft **1.21.11**. + +In the Minecraft Launcher, create an installation for version 1.21.11 (Installations → New installation) and use it to connect. The latest client version will not join a 1.21.11 server. ## Lab Environment Setup @@ -43,6 +44,8 @@ In the Minecraft Launcher, create an installation for version 1.21.11 (Installat 3. The workflow runs two jobs on every push: `secret-scan` and `build`. The `secret-scan` job uses [TruffleHog](https://github.com/trufflesecurity/trufflehog) to scan your git history for leaked credentials (like your DigitalOcean token) and blocks the build if it finds any. Make a small commit to `main` to trigger the workflow, then verify both jobs pass. Once complete, your container image will be available at `ghcr.io//msud-cmute-gitops-workshop:latest`. +4. By default, the package GitHub builds is **private** and your cluster will not be able to pull it. Go to your fork's **Packages** → `msud-cmute-gitops-workshop` → **Package settings** → **Change visibility** → **Public**. + ### Provision your cluster 1. Install and authenticate doctl: @@ -68,6 +71,8 @@ tofu plan tofu apply ``` +Cluster creation takes **~8 minutes**. Grab some water. + 5. Save your kubeconfig: ```bash @@ -91,19 +96,38 @@ You should see a single node in `Ready` status. Example: ```bash -NAME STATUS ROLES AGE VERSION -default-1x8h9 Ready 2m59s v1.36.0 +NAME STATUS ROLES AGE VERSION +default-37gop8 Ready 14m v1.36.0 ``` ### Bootstrap cluster infrastructure -1. Install Envoy and the Gateway API CRDs: +1. Install the Gateway API CRDs and Envoy Gateway: ```bash kubectl apply --server-side --force-conflicts \ -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.5.1/experimental-install.yaml ``` +You should see: + +```bash +customresourcedefinition.apiextensions.k8s.io/backendtlspolicies.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/gatewayclasses.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/gateways.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/grpcroutes.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/httproutes.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/listenersets.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/referencegrants.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/tcproutes.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/tlsroutes.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/udproutes.gateway.networking.k8s.io serverside-applied +validatingadmissionpolicy.admissionregistration.k8s.io/safe-upgrades.gateway.networking.k8s.io serverside-applied +validatingadmissionpolicybinding.admissionregistration.k8s.io/safe-upgrades.gateway.networking.k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/xbackendtrafficpolicies.gateway.networking.x-k8s.io serverside-applied +customresourcedefinition.apiextensions.k8s.io/xmeshes.gateway.networking.x-k8s.io serverside-applied +``` + ```bash helm install eg oci://docker.io/envoyproxy/gateway-helm \ --version v1.8.2 \ @@ -116,13 +140,18 @@ helm install eg oci://docker.io/envoyproxy/gateway-helm \ kubectl apply -f infra/envoy-gateway/gatewayclass.yaml ``` -You can verify that Envoy Gateway is working by running: +Verify Envoy Gateway is running and the GatewayClass is accepted: ```bash kubectl get pods -n envoy-gateway-system kubectl get gatewayclass eg ``` +```bash +NAME CONTROLLER ACCEPTED AGE +eg gateway.envoyproxy.io/gatewayclass-controller True 14s +``` + 2. Install cert-manager: ```bash @@ -156,10 +185,9 @@ kubectl create namespace argocd kubectl apply -n argocd --server-side -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml ``` -5. Verify everything is running: +5. Verify ArgoCD is running: ```bash -kubectl get pods -n envoy-gateway-system kubectl wait --for=condition=available deployment/argocd-server -n argocd --timeout=120s ``` @@ -187,7 +215,7 @@ kubectl apply -f k8s/argocd-httproute.yaml - `namespace.yaml` - `configmap.yaml` - `persistentvolumeclaim.yaml` - - `deployment.yaml` IMPORTANT: replace `` with your GitHub username + - `deployment.yaml` IMPORTANT: replace `` with your GitHub username (must be lowercase) - `service.yaml` - `gateway.yaml` IMPORTANT: replace `` in the ArgoCD HTTPS listener hostname - `tcproute.yaml` @@ -195,7 +223,13 @@ kubectl apply -f k8s/argocd-httproute.yaml 2. In `argocd/application.yaml`, look at the file and replace `` with your GitHub username. -3. Commit and push: +3. Check that you didn't miss any placeholders: + +```bash +grep -rn "YOUR_NAME\|YOUR_GITHUB" k8s/ argocd/ && echo "^^ FIX THESE BEFORE CONTINUING" || echo "all placeholders replaced" +``` + +4. Commit and push: ```bash git add -A @@ -203,19 +237,21 @@ git commit -m "chore: configure k8s manifests with my values" git push ``` -4. Apply the ArgoCD application: +5. Apply the ArgoCD application: ```bash kubectl apply -f argocd/application.yaml ``` -5. Watch ArgoCD deploy everything: +6. Watch ArgoCD deploy everything: ```bash kubectl get applications -n argocd kubectl get pods -n paper ``` +The paper pod takes **1–2 minutes** to become `1/1 Ready` (the startup probe waits for the Minecraft server to boot). + ### Expose the server All traffic (Minecraft and the ArgoCD UI) flows through the single Gateway LoadBalancer. @@ -226,7 +262,21 @@ All traffic (Minecraft and the ArgoCD UI) flows through the single Gateway LoadB kubectl get gateway paper-gateway -n paper ``` -2. Create a DNS record for ArgoCD pointing to the Gateway IP: +The `ADDRESS` field takes **1–3 minutes** to appear while DigitalOcean provisions the load balancer. Your certificates take another 1–3 minutes to become Ready — check with: + +```bash +kubectl get certificates -n paper +``` + +2. (Optional) Verify the Minecraft port is reachable through the Gateway: + +```bash +timeout 3 bash -c '/25565' && echo OPEN || echo CLOSED +``` + +If this prints `OPEN`, Envoy is routing TCP traffic to your server. If it prints `CLOSED`, wait a minute and try again before debugging. + +3. Create a DNS record for ArgoCD pointing to the Gateway IP: ```bash doctl compute domain records create cmute.cloud \ @@ -236,7 +286,7 @@ doctl compute domain records create cmute.cloud \ --record-ttl 300 ``` -3. Create a DNS record for your Minecraft server pointing to the **same** Gateway IP: +4. Create a DNS record for your Minecraft server pointing to the **same** Gateway IP: ```bash doctl compute domain records create cmute.cloud \ @@ -246,13 +296,13 @@ doctl compute domain records create cmute.cloud \ --record-ttl 300 ``` -4. Get the initial ArgoCD admin password and log in at `https://argocd..mc.labs.cmute.cloud`: +5. Get the initial ArgoCD admin password and log in at `https://argocd..mc.labs.cmute.cloud`: ```bash kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo ``` -5. Connect with your Minecraft client to `.mc.labs.cmute.cloud`. +6. Connect with your Minecraft client (version **1.21.11**) to `.mc.labs.cmute.cloud`. ### Test GitOps @@ -270,7 +320,7 @@ Make a change and watch ArgoCD sync it automatically. kubectl get pods -n paper ``` -ArgoCD will detect the changes and roll out a new pod automatically. +Within about 3 minutes, ArgoCD will detect the change and roll out a new pod automatically. You'll briefly be disconnected from the server while the pod restarts — that's the deployment happening. Watch it live in the ArgoCD UI. ## Extras @@ -278,9 +328,4 @@ Add Prometheus metrics and a Grafana dashboard for your server: [extras/observab ## Cleanup -Destroy your cluster when you're done: - -```bash -cd infra/tofu -tofu destroy -``` \ No newline at end of file +Cluster teardown is handled by the instructor after the workshop. Leave your cluster running. \ No newline at end of file diff --git a/argocd/application.yaml b/argocd/application.yaml index 6afbabf..54ba3d2 100644 --- a/argocd/application.yaml +++ b/argocd/application.yaml @@ -7,10 +7,10 @@ spec: project: default source: # Replace with your GitHub username. - repoURL: https://github.com/xata/msud-cmute-gitops-workshop.git + repoURL: https://github.com//msud-cmute-gitops-workshop.git # Replace main with your branch if you made a specific branch # You will have to update the CI workflow to use the branch - targetRevision: test + targetRevision: main path: k8s destination: server: https://kubernetes.default.svc diff --git a/infra/cert-manager/clusterissuer.yaml b/infra/cert-manager/clusterissuer.yaml index 5e686eb..6be204f 100644 --- a/infra/cert-manager/clusterissuer.yaml +++ b/infra/cert-manager/clusterissuer.yaml @@ -5,7 +5,7 @@ metadata: spec: acme: server: https://acme-v02.api.letsencrypt.org/directory - email: mwal@msudenver.edu + email: privateKeySecretRef: name: letsencrypt-do solvers: diff --git a/infra/tofu/terraform.tfvars.example b/infra/tofu/terraform.tfvars.example index 48f9ef9..ad5aeaf 100644 --- a/infra/tofu/terraform.tfvars.example +++ b/infra/tofu/terraform.tfvars.example @@ -1,5 +1,5 @@ do_token = "dop_v1_your_token_here" -cluster_name = "paper-" +cluster_name = "paper-" vpc_uuid = "9190e0e9-f6dd-41e1-aa57-8d8fb2269ba4" region = "sfo3" k8s_version = "1.36.0-do.3" diff --git a/k8s/argocd-httproute.yaml b/k8s/argocd-httproute.yaml index 549fe0e..0cad554 100644 --- a/k8s/argocd-httproute.yaml +++ b/k8s/argocd-httproute.yaml @@ -9,7 +9,7 @@ spec: namespace: paper sectionName: argocd-https hostnames: - - argocd.test.mc.labs.cmute.cloud + - argocd..mc.labs.cmute.cloud rules: - backendRefs: - name: argocd-server diff --git a/k8s/certificate.yaml b/k8s/certificate.yaml index 084382d..93bc4c1 100644 --- a/k8s/certificate.yaml +++ b/k8s/certificate.yaml @@ -3,12 +3,12 @@ kind: Certificate metadata: name: paper-tls spec: - # Replace with the same value used in your DNS record. + # Replace with the same value used in your DNS record. # Note: Minecraft is plain TCP and does not consume this cert. It is here # to demonstrate the cert-manager + DNS-01 flow end to end. secretName: paper-tls dnsNames: - - test.mc.labs.cmute.cloud + - .mc.labs.cmute.cloud issuerRef: name: letsencrypt-do kind: ClusterIssuer @@ -18,11 +18,11 @@ kind: Certificate metadata: name: argocd-tls spec: - # Replace . This cert IS used by the Gateway's HTTPS listener + # Replace . This cert IS used by the Gateway's HTTPS listener # to terminate TLS for the ArgoCD UI. secretName: argocd-tls dnsNames: - - argocd.test.mc.labs.cmute.cloud + - argocd..mc.labs.cmute.cloud issuerRef: name: letsencrypt-do kind: ClusterIssuer diff --git a/k8s/configmap.yaml b/k8s/configmap.yaml index 2fae567..f8956fd 100644 --- a/k8s/configmap.yaml +++ b/k8s/configmap.yaml @@ -5,7 +5,7 @@ metadata: data: server.properties: | server-port=25565 - motd=A GitOps Minecraft Server on k8s + motd=A Minecraft Server on k8s max-players=3 # online-mode=false lets any Minecraft client connect without a Mojang # account check. This is fine for a workshop, but never use it on a diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 332b8a3..782c16a 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -14,14 +14,15 @@ spec: labels: app: paper annotations: - configmap-hash: "2" + configmap-hash: "1" spec: securityContext: fsGroup: 1000 containers: - name: paper + # Replace # MAKE SURE THIS IS LOWERCASE OTHERWISE YOU'LL GET AN ERROR :) - image: ghcr.io/xata/msud-cmute-gitops-workshop:latest + image: ghcr.io//msud-cmute-gitops-workshop:latest ports: - containerPort: 25565 resources: diff --git a/k8s/gateway.yaml b/k8s/gateway.yaml index b7d6b10..5f6bddb 100644 --- a/k8s/gateway.yaml +++ b/k8s/gateway.yaml @@ -14,7 +14,7 @@ spec: - name: argocd-https protocol: HTTPS port: 443 - hostname: argocd.test.mc.labs.cmute.cloud + hostname: argocd..mc.labs.cmute.cloud tls: mode: Terminate certificateRefs: