Monday, November 9, 2020

K8s Ingress on minikube


HOWTO

https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide/

https://kubernetes.io/docs/concepts/services-networking/ingress/

https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/

https://github.com/kubernetes/ingress-nginx

https://www.joyfulbikeshedding.com/blog/2018-03-26-studying-the-kubernetes-ingress-system.html

https://minikube.sigs.k8s.io/docs/drivers/docker/#known-issues

 

GitHub repos

https://github.com/dveselka/devops-k8s/tree/main/complex

https://github.com/StephenGrider/multi-k8s

 

Start a cluster using the docker driver:

minikube start --driver=docker

To make docker the default driver:

minikube config set driver docker
 
[dave@dave complex]$ minikube config set driver docker
❗  These changes will take effect upon a minikube delete and then a minikube start
[dave@dave complex]$ minikube delete
🔥  Deleting "minikube" in docker ...
🔥  Deleting container "minikube" ...
🔥  Removing /home/dave/.minikube/machines/minikube ...
💀  Removed all traces of the "minikube" cluster.
[dave@dave complex]$ minikube start
😄  minikube v1.14.2 on Fedora 32
✨  Using the docker driver based on user configuration
👍  Starting control plane node minikube in cluster minikube
🔥  Creating docker container (CPUs=2, Memory=3900MB) ...
 🐳  Preparing Kubernetes v1.19.2 on Docker 19.03.8 ...
🔎 Verifying Kubernetes components...
🌟 Enabled addons: storage-provisioner, default-storageclass

❗ /usr/bin/kubectl is version 1.15.8-beta.0, which may have incompatibilites with Kubernetes 1.19.2.
💡 Want kubectl v1.19.2? Try 'minikube kubectl -- get pods -A'
🏄 Done! kubectl is now configured to use "minikube" by default
 

Check type of container

[dave@dave complex]$ docker info --format '{{.OSType}}'
linux


Provider specific steps

https://kubernetes.github.io/ingress-nginx/deploy/#provider-specific-steps

Google Cloud https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.0/deploy/static/provider/cloud/deploy.yaml


Minikube

[dave@dave complex]$ minikube addons enable ingress
🔎  Verifying ingress addon...
🌟  The 'ingress' addon is enabled

 

Apply config files

kubectl apply -f k8s/
service/client-cluster-ip-service created
deployment.apps/client-deployment created
persistentvolumeclaim/database-persistent-volume-claim created
ingress.networking.k8s.io/ingress-service created
service/postgres-cluster-ip-service created
deployment.apps/postgres-deployment created
service/redis-cluster-ip-service created
deployment.apps/redis-deployment created
service/server-cluster-ip-service created
deployment.apps/server-deployment created
deployment.apps/worker-deployment created

 Check HTTP connection

[dave@dave complex]$ minikube ip
192.168.49.2
[dave@dave complex]$ wget 192.168.49.2
--2020-11-09 14:13:35--  http://192.168.49.2/
Connecting to 192.168.49.2:80... connected.
HTTP request sent, awaiting response... 200 OK

 Add POSTGRESS password via k8s secret

[dave@dave complex]$ kubectl create secret generic pgpassword --from-literal PGPASSWORD=password123
secret/pgpassword created

 Check app in k8s dashboard

[dave@dave complex]$ minikube dashboard
🔌  Enabling dashboard ...
🤔  Verifying dashboard health ...
🚀  Launching proxy ...
🤔  Verifying proxy health ...
🎉  Opening http://127.0.0.1:42189/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...  

k8s dashboard 


No comments:

Post a Comment