introduce Have you ever spent a whole day trying to get started with Kubernetes? Thanks to some new tools that have emerged recently, you don't have to worry about this anymore. In this post, I will show you the steps to start a cluster in a single Docker container using kind. What is Kind? Since kind is implemented in go language, please make sure you have installed the latest version of golang. According to the developer documentation, go1.11.5 and above are recommended. To install kind, run these commands (may take a while to run) kind (Kubernetes IN Docker) is a tool for building Kubernetes clusters based on Docker. It is very suitable for building a local development/test environment based on Kubernetes. go get -u sigs.k8s.io/kind kind create cluster Then confirm that the "kind" cluster is available. kind get clusters Setting up kubectl Similarly, install the latest version of kubernetes-cli using Homebrew or Chocolatey. The latest version of Docker includes Kubernetes functionality but uses an older version of kubectl. Run this command to check its version number. kubectl version Make sure it says GitVersion: "v1.14.1" or higher. If you find yourself running kubectl via Docker, try using brew link or reordering your environment variables. Once kubectl and kind are installed, open a bash console and run these commands. export KUBECONFIG="$(kind get kubeconfig-path)" kubectl cluster-info If kind is configured correctly, some information will be displayed. Now you can proceed with the following work. yeah! Deploy your first application What do we need to deploy to the cluster? A good choice is Wordpress because it includes MySQL and PHP applications. Luckily, there is an official primer and it describes it very well. We can try to use the kind cluster we just created to perform most of the steps. https://kubernetes.io/docs/tutorials/ First, download mysql-deployment.yaml and wordpress-deployment.yaml from this page. Run two cat commands to create kustomization.yaml. Once these yaml files are prepared, place the files in the respective directories as shown below. k8s-wp/ kustomization.yaml mysql-deployment.yaml wordpress-deployment.yaml Then apply it to your cluster. cd k8s-wp kubectl apply -k ./ If the command is executed successfully you will see output similar to the following:
Let's check the status of the cluster by typing these commands: kubectl get secrets kubectl get pvc kubectl get pods kubectl get services wordpress Wait for all pods to become Running. Then, run this command to get the service. kubectl port-forward svc/wordpress 8080:80 Then open http://localhost:8080/ Look! If you want to view the database, inspect your pod, run a command like this, then open your client app. kubectl port-forward wordpress-mysql-bc9864c58-ffh4c 3306:3306 in conclusion kind is a good choice for minikube because it only uses a single Docker container. By combining it with Kustomze, which is integrated into Kubernetes 1.14, it is even easier to try out Kubernetes on your local machine. This is the end of this article about using kind and Docker to start a local Kubernetes environment. For more information about using kind and Docker to start a local Kubernetes environment, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: MySQL derived table (Derived Table) simple usage example analysis
>>: Guide to using env in vue cli
Hi, everyone; today is Double 12, have you done a...
Table of contents Class Component Functional Comp...
This article example shares the specific code of ...
Install boost There are many ways to call C/C++ f...
I updated MySQL 8.0 today. The first problem: Nav...
Overview There are many open source network monit...
Scenario How to correctly render lists up to 1000...
#1. Download # #2. Unzip to local and modify nece...
When an employer asks you whether an index will b...
In actual projects, there are relationships betwe...
1. The Importance of Indexes Indexes are used to ...
1. Download the CentOS image 1.1 Download website...
Copy code The code is as follows: <!DOCTYPE ht...
1. First, we create a .json file for interactive ...
If you have experience in vue2 project developmen...