deploy devcontainer setups to kubernetes
- converts docker-compose devcontainer configs to k8s
- replaces caddy proxy with kubernetes ingress
- offers traefik, external-dns, and cert-manager as chart dependencies
- adds external-dns and cert-manager annotations
- creates deployable helm charts for dev environments
- smart cert-manager configuration (self-signed for local, Let's Encrypt for remote)
- builds custom devcontainer images with all features pre-installed
git clone <repo>
cd dev-kontainers
chmod +x install.sh
./install.shor local install:
INSTALL_DIR=~/.local/bin ./install.shbasic:
dev-kontainerscustom:
dev-kontainers --name mydev --ingress-class traefik --no-cert-managerdeploy automatically:
dev-kontainers --name mydev --deploy
# or
dev-kontainers --name mydev --dryrun falseoptions:
-n, --name- chart name (also used as namespace and release name)-o, --output- output directory-i, --ingress-class- ingress controller (default: traefik)--deploy- deploy chart after generating (default: false)--dryrun BOOL- set to false to deploy (default: true)--no-external-dns- skip external dns annotations--no-cert-manager- skip cert manager annotations--cert-issuer- cert issuer name-c, --compose-file- additional compose files
if you have a .devcontainer/devcontainer.json file, the tool can build a custom image with all your devcontainer features pre-installed:
- automatically detects devcontainer configuration
- installs devcontainer CLI if missing
- builds image during chart generation
- configures chart to use the custom image
- includes all features: docker, kubectl, helm, terraform, etc.
the tool will prompt you to build the custom image. if you decline, it uses the base image and you'll need to install tools manually in pods.
chart-name/- helm chart directorychart-name/deploy.sh- deployment scriptchart-name/CONVERSION_SUMMARY.md- what got converted- all your services as k8s manifests
- ingress with proper annotations
- no more caddy
you need these in your k8s cluster:
helm repo add traefik https://helm.traefik.io/traefik
helm repo update
helm install traefik traefik/traefik --namespace traefik --create-namespacekind clusters:
# option 1: port-forward (quick testing)
kubectl port-forward -n traefik svc/traefik 8080:80
# option 2: cluster with port mapping (recommended)
# add to kind config:
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 80
hostPort: 8080
- containerPort: 443
hostPort: 8443
# create cluster: kind create cluster --config=kind-config.yamlminikube clusters:
# option 1: tunnel (enables LoadBalancer)
minikube tunnel # run in separate terminal
# option 2: nodeport service
kubectl patch svc traefik -n traefik -p '{"spec":{"type":"NodePort"}}'
minikube service traefik -n traefik --urlk3d clusters:
# option 1: create cluster with port mapping
k3d cluster create dev --port '8080:80@loadbalancer' --port '8443:443@loadbalancer'
# option 2: port-forward existing cluster
kubectl port-forward -n traefik svc/traefik 8080:80docker-desktop:
# usually works with LoadBalancer, or use NodePort:
kubectl patch svc traefik -n traefik -p '{"spec":{"type":"NodePort"}}'
kubectl get svc traefik -n traefik # get the porthelm repo add jetstack https://charts.jetstack.io
helm install cert-manager jetstack/cert-manager --set installCRDs=true
# create letsencrypt issuer
kubectl apply -f - <<EOF
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: your-email@domain.com
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- http01:
ingress:
class: traefik
EOFhelm repo add external-dns https://kubernetes-sigs.github.io/external-dns
# for aws route53
helm install external-dns external-dns/external-dns --set \
provider=aws \
--set aws.zoneType=public \
--set txtOwnerId=external-dns
# for cloudflare
helm install external-dns external-dns/external-dns --set \
provider=cloudflare \
--set cloudflare.apiToken=your-tokenafter running the script:
cd your-chart-name
./deploy.shor manually:
helm install myapp . --namespace myapp --create-namespacecheck status:
kubectl get pods,svc,ingress -n myappsee charts/ directory for example conversions
no routes found: check your compose file has caddy: labels
ingress pending: wait for ingress controller or check loadbalancer
cert issues: verify cert-manager and issuer are working
dns not resolving: check external-dns logs and provider config
ports must be defined in compose file ports section or caddy.reverse_proxy labels. no fallbacks.