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
Preface: The "Getting Started with MySQL&quo...
Generally, during Qingming Festival, the National...
MySQL is a relational database management system....
Table of contents Technology Stack Backend build ...
The concept of relative path Use the current file...
This article describes how to boot the Linux syst...
Generally speaking, we can have the following two...
Location means "positioning", which is ...
1. Environmental Preparation The IP address of ea...
Table of contents The node version does not corre...
error message: ERROR 2002 (HY000): Can't conn...
1.0 Redis persistence Redis is an in-memory datab...
The span tag is often used when making HTML web pa...
Table of contents Writing Background Project Desc...
No way, no way, it turns out that there are peopl...