Author | Duan Chao source |Erda public account
** Introduction: Erda, as a one-stop cloud native PaaS platform, is now open source for developers to complete 70W + core code! ** While Erda is open source, we plan to write a series of articles “Cloud Native PaaS Platform Infrastructure based on K8s”, hoping that our experience can help more enterprises improve the construction of PaaS platform infrastructure.
Recommended articles:
- Kubernetes Ditches Docker, Where Do We Go From here?
- I can Lose Weight, But My Docker Image Has to Lose Weight!
Kind (Kubernets in Docker) is a tool that can quickly deploy a set of K8s locally. It is ideal for local deployment debugging or the scenario where you want to experience the latest version of K8s.
Create a simple
brew install kind kind create cluster --name test Creating cluster "kind" ... ✓ conquering nodes image (kindest/node:v1.13.4) ✓ Preparing nodes ✓ Creating kubeadm config ✓ Starting control-plane ️ Cluster creation complete. You can now use the cluster with: [root@node-2 ~]# kubectl get node NAME STATUS ROLES AGE VERSION kind-control-plane Ready master 99s v1.13.4Copy the code
By default, a single-node cluster is created. Want to create a more complex cluster? The configuration file goes up.
Create a cluster with a specific version of K8s
The configuration file
kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane image: Kindest/node: v1.18.15 @ sha256:5 c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4 - role: the worker image: Kindest/node: v1.18.15 @ sha256:5 c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4 - role: the worker image: The kindest/node: v1.18.15 @ sha256:5 c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4Copy the code
Create the cluster
kind create cluster --name kind --config cluster.yaml
Copy the code
For other versions of the cluster, see the mirror list here.
Create a cluster that contains the Ingress
The configuration file
kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane image: The kindest/node: v1.18.15 @ sha256:5 c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4 kubeadmConfigPatches: - | kind: InitConfiguration nodeRegistration: kubeletExtraArgs: node-labels: "ingress-ready=true" extraPortMappings: - containerPort: 80 hostPort: 80 protocol: TCP - containerPort: 443 hostPort: 443 protocol: TCP - role: worker image: Kindest/node: v1.18.15 @ sha256:5 c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4 - role: the worker image: The kindest/node: v1.18.15 @ sha256:5 c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4Copy the code
- extraPortMappings allow the local host to make requests to the Ingress controller over ports 80/443
Create the cluster
kind create cluster --name kind-ingress --config cluster.yaml
Copy the code
The deployment of Ingress
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
Copy the code
Once installed, you can access the Ingress locally
Curl http://127.0.0.1 curl -k https://127.0.0.1:443Copy the code
playability
Kind uses a container to simulate the node node, so you can perform node related operations in the container, such as modifying the kube-apiserver configuration file, viewing etCD, and so on.
If you want to know more about Erda, please add the little assistant wechat (Erda202106) to the communication group discussion, or click the link in the bottom to learn more!
- Erda Github: github.com/erda-projec…
- Erda Cloud website: www.erda.cloud/