Helm/Traefik

From Chorke Wiki
Jump to navigation Jump to search
helm repo add traefik https://traefik.github.io/charts
helm repo update && helm repo list
kubectl config get-contexts

Config

export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"

Install

kubectl get ns|grep traefik
kubectl delete ns   traefik
kubectl get ns|grep traefik
kubectl create ns   traefik

cat << YML | kubectl -n traefik apply -f -
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app.kubernetes.io/name: traefik
  name: traefik-pvc
spec:
  storageClassName: standard
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 128Mi
YML

cat <<YML | helm -n traefik install    traefik traefik/traefik --version=30.1.0 -f -
---
logs:
  general:
    level: INFO
ports:
  traefik:
    expose:
      default: true
autoscaling:
  enabled: false
persistence:
  size: 128Mi
  enabled: true
  existingClaim: traefik-pvc
ingressRoute:
  dashboard:
    enabled: false
ingressClass:
  enabled: true
  isDefaultClass: true
gateway:
  listeners:
    web:
      hostname: traefik.k8s.local
YML

xdg-open http://traefik.k8s.local &>/dev/null &
gnome-open http://traefik.k8s.local &>/dev/null &
x-www-browser http://traefik.k8s.local &>/dev/null &
sensible-browser http://traefik.k8s.local &>/dev/null &

Uninstall

helm uninstall -n traefik traefik
kubectl delete ns traefik

Swiss Knife

kubectl -n traefik run -i --tty --rm traefik-cli --image=alpine --restart=Never -- sh
apk --update add inetutils-telnet

telnet traefik 80
telnet traefik 443

ping traefik.k8s.local
ping host.minikube.internal

telnet traefik.traefik.svc.cluster.local 80
telnet traefik.traefik.svc.cluster.local 443

Playground

helm -n traefik install    traefik traefik/traefik --version=29.0.1
helm -n traefik upgrade -i traefik traefik/traefik --version=30.1.0
helm show values bitnami/traefik --version=30.1.0|less

kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten

kubectl -n traefik delete all --all
kubectl -n traefik delete ing --all
kubectl -n traefik delete sts --all
kubectl -n traefik delete svc --all
kubectl -n traefik delete pvc --all
kubectl -n traefik delete pv  --all

kubectl -n traefik rollout history deploy traefik
kubectl -n traefik rollout restart deploy traefik
kubectl -n traefik rollout status  deploy traefik
kubectl -n traefik exec -it svc/traefik -c traefik -- which traefik
kubectl -n traefik exec -it svc/traefik -c traefik -- sh
kubectl -n traefik logs -f  svc/traefik -c traefik

References