This repository is a tutorial and tools to implement Traefik proxy on Kubernetes cluster.
More information about Traefik Proxy you can read from here
Support only MacOS, Linux
$ curl -O https://raw.githubusercontent.com/iamapinan/kubeplay-nginx-wordpress/main/traefik-setup.sh
$ chmod +x traefik-setup.sh
$ ./traefik-setup.sh
- Install Traefik Resource Definitions
$ kubectl apply -f https://raw.githubusercontent.com/traefik/traefik/v2.9/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml
- Install RBAC for Traefik
$ kubectl apply -f https://raw.githubusercontent.com/traefik/traefik/v2.9/docs/content/reference/dynamic-configuration/kubernetes-crd-rbac.yml
- Install Traefik Helmchart
$ helm repo add traefik https://traefik.github.io/charts
$ helm repo update
$ helm install traefik traefik/traefik
- Verify service is running
$ kubectl get svc -l app.kubernetes.io/name=traefik
$ kubectl get po -l app.kubernetes.io/name=traefik
**After this step you need to edit namespace and detail in all files. If you implement by shell script the next step is here.**
$ htpasswd -nB user | tee auth-secret
# New password:
# Re-type new password:
# Example output user:$2y$05$W4zCVrqGg8wKtIjOAU.gGu8MQC9k7sH4Wd1v238UfiVuGkf0xfDUu
# Dry run to create a secret deployment.
$ kubectl create secret generic -n traefik dashboard-auth-secret \
--from-file=users=auth-secret -o yaml --dry-run=client | tee dashboard-secret.yaml
This will automatic create a deployment file dashboard-secret.yaml
Copy users secret from dashboard-secret.yaml
and replace in traefik-dashboard.yaml
-
Enable traefik dashbaord
kubectl apply -f traefik-dashboard.yaml
-
Deploy your nginx
kubectl apply -f nginx-deployment.yaml
-
Deploy traefik ingress routes
kubectl apply -f ingress-deployment.yaml
$ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
LICENSE MIT
- Apinan Woratrakun (iamapinan)
- Email: iamapinan(at)gmail(dot)com
- YouTube: https://www.youtube.com/@IamApinan
- Facebook: https://facebook.com/9apinan
🙏 Please support me by subscribe on my YouTube Channel