Author | Duan Chao

Source |Erda public account

As a one-stop cloud native PaaS platform, Erda is now open source for developers to complete all 70W + core code!While Erda is open source, we plan to write a series of articles called cloud Native PaaS Platform Infrastructure based on K8s, hoping that our experience can help more enterprises improve their 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.4

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 c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4

Create the cluster

kind create cluster --name kind --config  cluster.yaml

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 c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4

  • 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

The deployment of Ingress

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml

Once installed, you can access the Ingress locally

Curl http://127.0.0.1 curl -k https://127.0.0.1:443

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 is at https://github.com/erda-project/erda
  • Erda Cloud website: https://www.erda.cloud/