Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 2.88 KB

kubernetes.md

File metadata and controls

68 lines (51 loc) · 2.88 KB

Usage with Kubernetes

Requirements

How it works in devbox?

For each stack supporting K8S deployment, a k8s-deploy.sh helper script is provided to :

  • Create a namespace for the stack
  • Deploy the stack either with Kustomize (kubectl apply -k ...) or helm (helm upgrade --install ...)
  • Create Ingress resource(s) using "bash templating" to ease customization using environment variables (ex : DEVBOX_HOSTNAME=dev.my-domain.com)

Load Balancing

Stacks are created assuming the :

The following environment variables provides some option for Ingress resources creation :

Name Description Default value
DEVBOX_HOSTNAME The base domain use to expose applications (ex : https://whoami.${DEVBOX_HOSTNAME}) dev.localhost
DEVBOX_INGRESS The ingressClassName to select an ingress controller traefik
DEVBOX_ISSUER The name of the ClusterIssuer for cert-manager mkcert

The principle is illustrated bellow for https://whoami.dev.localhost :

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: whoami
  annotations:
    cert-manager.io/cluster-issuer: "${DEVBOX_ISSUER}"
spec:
  ingressClassName: ${DEVBOX_INGRESS}
  rules:
  - host: whoami.$DEVBOX_HOSTNAME
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: whoami
            port:
              number: 80
  tls:
  - hosts:
    - whoami.$DEVBOX_HOSTNAME
    secretName: whoami-cert

Moving to production?

Note that :

  • You should not use resources from this repository!
  • You may have to deploy in an existing namespace provided by an administrator
  • Instead of using bash scripts to handle variables, you may use tools like ArgoCD, GitLab-CI,...