Docker Desktop installs a local Kubernetes cluster

Table of contents

Download and install instructions

Download Docker Desktop

Windows needs to enable Hyper-v

enable kubernetes

kubectl configuration

Set the path environment variable

 Verify that the installation was successful

 Realize the deployment of Nginx container

nginx creation in order

 Information about Nginx


Setup local Kubernetes cluster with Docker Desktop - DEV Community

The link above gives some inspiration.

Download and install instructions

Download Docker Desktop

Download Docker Desktop | Docker https://www.docker.com/products/docker-desktop/

Windows needs to enable Hyper-v

enable kubernetes

Check Enable kubernetes, it will start here, but you need to restart the computer once.

Deploy on Kubernetes

kubectl configuration

Set the path environment variable

Reference: Deploy on Kubernetes
 

#mac
/usr/local/bin/kubectl

#windows
C:\Program Files\Docker\Docker\Resources\bin\kubectl.exe

 Verify that the installation was successful

kubectl cluster-info

 Realize the deployment of Nginx container

nginx creation in order

step:

1. Create a deployment

2. Publish to the specified port

C:\Users\boonya>kubectl create deploy nginx --image=nginx:alpine
deployment.apps/nginx created

C:\Users\boonya>kubectl expose deploy nginx --port=80 --target-port=8000
service/nginx exposed

C:\Users\boonya>kubectl get service nginx
NAME    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
nginx   ClusterIP   10.97.199.160   <none>        80/TCP    19s

C:\Users\boonya> kubectl port-forward deployment/nginx :80
Forwarding from 127.0.0.1:59996 -> 80
Forwarding from [::1]:59996 -> 80
Handling connection for 59996
Handling connection for 59996
Handling connection for 59996

 Information about Nginx

Access address: 127.0.0.1:59996

View pods:

Check out the Docker Desktop container:

So: the first Nginx container is created through k8s and it's done!

Guess you like

Origin blog.csdn.net/boonya/article/details/129401404
Recommended