“This is the 21st day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021”

Click on me to enter minikube trial

Today let’s try to use the minikube, can enter to kubernetes. IO/useful/docs/tut… Feel it directly on the page, or through the following instructions, put minikube into our server for use

Simply install minikube

Linux

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube

The Windows

New-Item -Path 'c:\' -Name 'minikube' -ItemType Directory -Force Invoke-WebRequest -OutFile 'c:\minikube\minikube.exe' -Uri 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe' -UseBasicParsing

For example,

Run our cluster

minikube start

Start the cluster

minikube pause

Suspend Kubernete without affecting the deployed application

$ minikube pause
* Pausing node m01 ... 
* Paused 20 containers in: kube-system, kubernetes-dashboard, storage-gluster, istio-operator
Copy the code

At this point minikube has been paused, we can not view the pod list

minikube unpause

Unpaused instances

$ minikube unpause
* Unpausing node m01 ... 
* Unpaused 20 containers in: kube-system, kubernetes-dashboard, storage-gluster, istio-operator
Copy the code

minikube stop

Stop minikue

minikube addons list

Lists the currently supported plug-ins

kubectl config view

View the configuration of Kubectl

kubectl get pod -A

Lists all namespace objects

Deploying an application

$Kubectl create deployment hello - xiaomotong -- image = k8s. GCR. IO/echoserver: 1.4
deployment.apps/hello-xiaomotong created
Copy the code

Hello-xiaomotong has been deployed to the cluster

  • NAMESPACE

The namespace

  • NAME

The application name

  • READY

Indicates that the POD can service the request and should be added to the load balancing pool of the corresponding service. There are other identifiers here, which we can learn more about when we write more about POD

  • STATUS

Is in the Running state and is Running normally

Exposed service ports

  • Expose the service port. Expose port 9999
$ kubectl expose deployment hello-xiaomotong --type=NodePort --port=9999
service/hello-xiaomotong exposed
Copy the code

kubectl get service

Viewing Service Information

As you can see, our external port 9999 is mapped to port 32403 inside the service, so now our external port 9999 inside the service can access the service inside the pod

K8S 3-clock external access mode

Here we can see the TYPE field, currently can have two types, actually this is k8S external access mode, there are three types:

  • LoadBalancer

  • NodePort

  • Ingress

The preceding three methods import external traffic to the cluster, but the implementation methods are different

ClusterIP is the default service within the K8S cluster. Other applications in the cluster can access this service, but external applications cannot access it.

If external access to ClusterIP services is needed, it is also possible, and a proxy is needed. We can discuss the application modes, scenarios, advantages and disadvantages of the above methods in detail later

Delete the cluster

minikube delete

minikube delete  --all
Copy the code

If you are interested, please check out the Monikube handbook

Today is here, learning, if there is a deviation, please correct

Welcome to like, follow and favorites

Friends, your support and encouragement, I insist on sharing, improve the quality of the power

All right, that’s it for this time

Technology is open, our mentality, should be more open. Embrace change, live in the sun, and strive to move forward.

I am Nezha, welcome to like, see you next time ~