Deploy New Application

Step-by-step guide for deploying a new application on the MEGATRON K3s cluster with external access via Cloudflare tunnel.

Prerequisites

  • Application container image (in Harbor or public registry)
  • Domain/subdomain chosen
  • Namespace determined

Steps

1. Create Namespace

kubectl create namespace <app-name>

2. Deploy Application

Create deployment, service, and any required ConfigMaps/Secrets:

kubectl apply -f deployment.yaml -n <app-name>
kubectl apply -f service.yaml -n <app-name>

3. Create IngressRoute

apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: <app-name>-route
  namespace: <app-name>
spec:
  entryPoints:
    - websecure
  routes:
    - match: Host(`<app-name>.m3gatr0n.com`)
      kind: Rule
      services:
        - name: <service-name>
          port: <port>

4. Add Cloudflare Tunnel Route

mgt route add <app-name>.m3gatr0n.com

5. Create TLS Certificate (optional)

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: <app-name>-tls
  namespace: <app-name>
spec:
  secretName: <app-name>-tls
  issuerRef:
    name: letsencrypt-prod
    kind: ClusterIssuer
  dnsNames:
    - <app-name>.m3gatr0n.com

6. Verify

curl -v https://<app-name>.m3gatr0n.com/
kubectl get pods -n <app-name>
kubectl get ingressroute -n <app-name>

See Add Cloudflare Route for detailed tunnel configuration.

TODO: expand with Helm-based deployment option, secret management via Vault, and CI/CD pipeline integration via Devtron.