Get Started to use Kubernetes with the help of minikube

Introduction

https://minikube.sigs.k8s.io/docs/start/

https://www.youtube.com/watch?v=IMOZCDhH7do

Brief idea

  • Container – In Minikube, containers are used as the building blocks of creating applications.

  • Pod – Pod is a collection of one or more containers that share storage and network resources. Pods contain the definition of how the containers should be run in Minikube. Minikube uses these definitions to maintain the necessary resources. For example, you can define you need two pods. During execution, if a pod goes down, Minikube will automatically fire up a new pod.

  • Deployments — I don’t know this yet: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

  • Service – Because pods are replaceable, Minikube needs an abstraction layer to keep the interaction between the different pods seamless. For example, if a pod dies and a new pod is created, the application users shouldn’t get bogged down in the details of network addresses and related issues. Services are wrappers around the pods to create levels of abstraction.

  • Master – Master coordinates the cluster. It’s like the brains of the operation.

  • Node – Workers who run the pods.

  • kubectl – It’s the command line interface for running commands on Kubernetes cluster.

Let’s do an experiment

Create a ‘deployment’

kubectl create deployment my_nginx --image=nginx:latest --port=80

#--port=-1: The port that this container exposes.

Expose that ‘deployment’

kubectl expose deployment my-nginx --type=NodePort --port=2525 --target-port=80

#--port = The port that the service should serve on.
#--target-port = Name or number for the port on the container that the service should direct traffic to. (port that the container exposed)

Launch your service

minikube service my-nginx --url
minikube service my-nginx

Forward your service to HOST IP

kubectl port-forward service/my-nginx 1100:2525

Now you should be able to visit your service from http://127.0.0.1:1100

How to delete them all?

minikube dashboard

Do it by click those UI buttons. You can do it by yourself without my guide!

Author 

https://yingshaoxo.blogspot.com/2021/05/get-started-to-use-kubernetes-with-help.html