Ingress Egress Controler

Kubernetes dla każdego – sztuka konteneryzacji

Ingress & Egress Controler

Ingress - objekt API, który zarządza zewnętrznym dostępem do usługi w ramach klastra (usługi service)

Ingress Controller - implementacja obiektu Ingress w ramach klastra

Typy ingress

Do wystawienia usługi na świat poza klaster nie jest konieczny Ingress, można wykorzystać:

Egress

Ruch wychodzący z klastra. Do zarządzania ruchem wychodzącym można wykorzystać NetworkPolicy, który definiuje zasady Ingress and Engress

Porównanie

Ingress Controler Azure

  1. az aks create -g szkchm_k8s_t6_l53 -n IngressDemoAKS --node-count 1 --location westeurope
  2. az aks get-credentials --name IngressDemoAKS --resource-group szkchm_k8s_t6_l53
    • kubectl config get-contexts
  3. Instalacja Chocolatey oraz Helm
    • Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    • choco install kubernetes-helm
  4. Dodanie uprawnień dla tillera w klastrze ( oraz )
    • kubectl create serviceaccount -n kube-system tiller ServiceAccount
    • kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller ClusterRole
  5. helm init --service-account tiller Inicjalizacja Tillera na klastrze
  6. helm install stable/nginx-ingress --set controller.replicaCount=1 --set controller.nodeSelector."beta\.kubernetes\.io/os"=linux --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux Instalcja NGINX Ingress Controller w klastrze
    • kubectl get services
    • kubectl get services -l app=nginx-ingress
  7. kubectl apply -f deployment.yaml utworzenie deploymentu opisującego poda
    • kubectl get pod
    • kubectl get deployment
  8. kubectl apply -f service.yaml
    • kubectl get svc
  9. kubectl apply -f route.yaml stworzenie obiektu Ingressu, opisujący powiązanie requestu z serwisem

Pliki