Skip to content

Deploying applications using Ingress using minikube. Good for quick quick testing, Client Demo etc

Notifications You must be signed in to change notification settings

somrajroy/OpenSourceProject-KubernetesIngressWithMinikube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Deploying applications using Ingress - Minikube

Deploying applications using Ingress using minikube. Good for quick testing, POC's, Demo etc purposes

  • Below is example where an Ingress sends all its traffic to one Service. In this demo we will use ingress to send traffic to 3 services - cats, dogs and birds:
    image
  • An Ingress is a rule that governs how a service securely inside the Kubernetes cluster can safely access the outside world to allow user access. An ingress controller, a proxy, sits at the edge of the cluster’s network waiting for new rules. It processes them and maps each service to a specific domain name or URL path for public use. It is the Kubernetes project itself that develops and maintains the Ingress, but other open source projects develop ingress controllers, implement them, and create unique features.
  • Just like other applications, ingress controllers are pods, visible parts of the cluster. Ingress controllers are built using underlying reverse proxies that lend them load balancing and Layer 7 routing capabilities. Each proxy is its own product with a unique set of features.
  • Ingress controllers work at layer 7 and can use more intelligent rules to distribute application traffic. Ingress controllers typically route HTTP/HTTPS traffic to different applications based on the inbound URL.
    image

Steps to be followed :

  • Clone the repository and navigate to lab-05 folder in Powershell/CLI
  • Enable the NGINX Ingress controller in minikube
    $ minikube addons enable ingress
  • Below success message will come
    image
  • A new namespace "ingress-nginx" will be created. Inspect the pods and services
    $ kubectl get svc -n ingress-nginx
    $ kubectl get pods -n ingress-nginx
    image
    image
  • Deploy the NGINX ingress controller in minikube (Copy/Paste of below command from Github sometimes gives error. In that case clean up the enviornment as mentioned in last section and then run the command from the "command.txt" file uploaded in the repo(enabling ingress addon (NGINX Ingress controller) once again from the step mentioned in first step))
    New command to create NGINX ingress controller without customizing the defaults
    $ helm install nginx-ingress ingress-nginx/ingress-nginx --create-namespace --namespace ingress-basic --set controller.replicaCount=2 --set controller.nodeSelector."kubernetes.io/os"=linux --set defaultBackend.nodeSelector."kubernetes.io/os"=linux
    Old command (deprecated but still may work)
    $ helm install nginx-ingress ingress-nginx/ingress-nginx --create-namespace --namespace ingress-basic --set controller.replicaCount=2 --set controller.nodeSelector."beta.kubernetes.io/os"=linux --set defaultBackend.nodeSelector."beta.kubernetes.io/os"=linux

Deploy

  • Deploy cats, dogs and birds applications
    $ kubectl apply -f cats.yaml
    $ kubectl apply -f dogs.yaml
    $ kubectl apply -f birds.yaml
  • Create the ingress resource
    $ kubectl apply -f ingress.yaml
  • List pods, services and ingress
    $ kubectl get pods
    $ kubectl get svc
    $ kubectl get ingress
  • Get the ingress controller service name (type LoadBalancer)
    $ kubectl get svc -n ingress-basic
    image
  • Get the URL ingress controller service by name we received in last step
    $ minikube service nginx-ingress-ingress-nginx-controller -n ingress-basic
    image
  • Browse to the cats, dogs and birds service by appending "/cats", "/dogs", "/birds". For example :
    $ http://192.168.59.100:30053/cats
    $ http://192.168.59.100:30053/dogs
    $ http://192.168.59.100:30053/birds

Clean up

$ kubectl delete ingressclass nginx
$ kubectl delete all --all -n ingress-basic
$ kubectl delete all --all -n ingress-nginx
$ kubectl delete namespace ingress-basic
$ kubectl delete namespace ingress-nginx
$ kubectl delete all --all

References

About

Deploying applications using Ingress using minikube. Good for quick quick testing, Client Demo etc

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published