Let's try to use kind
docker
I have already installed docker.
[root@vm01 ~]# docker version Client: Docker Engine - Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:27:04 2020 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 19.03.8 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:25:42 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683 [root@vm01 ~]#
install kubectl
please see https://kubernetes.io/docs/tasks/tools/install-kubectl/
[root@vm01 ~]# curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 41.9M 100 41.9M 0 0 57.4M 0 --:--:-- --:--:-- --:--:-- 57.5M [root@vm01 ~]# ls -l kubectl -rw-r--r-- 1 root root 44032000 May 5 10:33 kubectl [root@vm01 ~]
[root@vm01 ~]# chmod +x ./kubectl [root@vm01 ~]# mv ./kubectl /usr/local/bin/kubectl [root@vm01 ~]# ls -l /usr/local/bin/kubectl -rwxr-xr-x 1 root root 44032000 May 5 10:33 /usr/local/bin/kubectl [root@vm01 ~]# [root@vm01 ~]# kubectl version --client Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"} [root@vm01 ~]#
install kind
and I install kind command.
[root@vm01 ~]# curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.8.1/kind-$(uname)-amd64 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 97 100 97 0 0 84 0 0:00:01 0:00:01 --:--:-- 85 100 629 100 629 0 0 283 0 0:00:02 0:00:02 --:--:-- 614k 100 9900k 100 9900k 0 0 1134k 0 0:00:08 0:00:08 --:--:-- 2081k [root@vm01 ~]# [root@vm01 ~]# ls -l kind -rw-r--r-- 1 root root 10133844 May 5 11:14 kind [root@vm01 ~]# chmod +x ./kind [root@vm01 ~]# mv ./kind /usr/local/bin/ [root@vm01 ~]# ls -l /usr/local/bin/ total 52900 -rwxr-xr-x 1 root root 10133844 May 5 11:14 kind -rwxr-xr-x 1 root root 44032000 May 5 10:33 kubectl [root@vm01 ~]# [root@vm01 ~]# kind version kind v0.8.1 go1.14.2 linux/amd64 [root@vm01 ~]#
create cluster by kind
I execute "kind create cluster" command.
[root@vm01 ~]# kind create cluster Creating cluster "kind" ... ?? Ensuring node image (kindest/node:v1.18.2) ? ? Ensuring node image (kindest/node:v1.18.2) ? ? Preparing nodes ? ? Writing configuration ? ? Starting control-plane ?? ? Installing CNI ? ? Installing StorageClass ? Set kubectl context to "kind-kind" You can now use your cluster with: kubectl cluster-info --context kind-kind Have a nice day! ? [root@vm01 ~]#
[root@vm01 ~]# kind version kind v0.8.0 go1.14.2 linux/amd64 [root@vm01 ~]#
[root@vm01 ~]# kubectl cluster-info --context kind-kind Kubernetes master is running at https://127.0.0.1:40867 KubeDNS is running at https://127.0.0.1:40867/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. [root@vm01 ~]#
multi node
[root@vm01 ~]# vi kind-cluster.yaml [root@vm01 ~]# cat kind-cluster.yaml kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - role: worker - role: worker [root@vm01 ~]# [root@vm01 ~]# kind create cluster --config kind-cluster.yaml Creating cluster "kind" ... ? Ensuring node image (kindest/node:v1.18.2) ? ? Preparing nodes ? ? ? ? Writing configuration ? ? Starting control-plane ?? ? Installing CNI ? ? Installing StorageClass ? ? Joining worker nodes ? Set kubectl context to "kind-kind" You can now use your cluster with: kubectl cluster-info --context kind-kind Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community ? [root@vm01 ~]# [root@vm01 ~]# kind get clusters kind [root@vm01 ~]# [root@vm01 ~]# kubectl cluster-info --context kind-kind Kubernetes master is running at https://127.0.0.1:37921 KubeDNS is running at https://127.0.0.1:37921/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. [root@vm01 ~]# [root@vm01 ~]# kubectl config current-context kind-kind [root@vm01 ~]#
[root@vm01 ~]# kubectl get node NAME STATUS ROLES AGE VERSION kind-control-plane Ready master 2m34s v1.18.2 kind-worker Ready <none> 119s v1.18.2 kind-worker2 Ready <none> 119s v1.18.2 [root@vm01 ~]# [root@vm01 ~]# kubectl get pod No resources found in default namespace. [root@vm01 ~]# [root@vm01 ~]# kubectl get namespace NAME STATUS AGE default Active 2m47s kube-node-lease Active 2m48s kube-public Active 2m48s kube-system Active 2m48s local-path-storage Active 2m44s [root@vm01 ~]#
from docker view, I check processes
[root@vm01 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 43ca4ecef777 kindest/node:v1.18.2 "/usr/local/bin/entr…" 30 minutes ago Up 30 minutes kind-worker a883230bf683 kindest/node:v1.18.2 "/usr/local/bin/entr…" 30 minutes ago Up 30 minutes 127.0.0.1:37921->6443/tcp kind-control-plane 4b819e4548b2 kindest/node:v1.18.2 "/usr/local/bin/entr…" 30 minutes ago Up 30 minutes kind-worker2 [root@vm01 ~]# [root@vm01 ~]# docker exec -it kind-worker bash root@kind-worker:/# ps -aef UID PID PPID C STIME TTY TIME CMD root 1 0 0 01:21 ? 00:00:00 /sbin/init root 113 1 0 01:21 ? 00:00:00 /lib/systemd/systemd-journald root 122 1 0 01:21 ? 00:00:07 /usr/local/bin/containerd root 359 1 1 01:22 ? 00:00:28 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runti root 405 1 0 01:22 ? 00:00:00 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id 7b08e0c8ee21ecc616d07790193a1bcde61430db81ae90d0b9eccd25b5a9c8f4 -address /run/containerd/containerd.sock root 431 1 0 01:22 ? 00:00:00 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id f4794a89cee3d1e946e1dad73ca9b902368c6cfe328d2fa06272eb9a6d6fc0b7 -address /run/containerd/containerd.sock root 437 405 0 01:22 ? 00:00:00 /pause root 464 431 0 01:22 ? 00:00:00 /pause root 546 405 0 01:22 ? 00:00:01 /usr/local/bin/kube-proxy --config=/var/lib/kube-proxy/config.conf --hostname-override=kind-worker root 623 431 0 01:22 ? 00:00:00 /bin/kindnetd root 1669 0 0 01:53 pts/1 00:00:00 bash root 1681 1669 0 01:53 pts/1 00:00:00 ps -aef root@kind-worker:/# [root@vm01 ~]# docker exec -it kind-control-plane bash root@kind-control-plane:/# ps -aef UID PID PPID C STIME TTY TIME CMD root 1 0 0 01:21 ? 00:00:00 /sbin/init root 110 1 0 01:21 ? 00:00:00 /lib/systemd/systemd-journald root 122 1 0 01:21 ? 00:00:11 /usr/local/bin/containerd root 280 1 0 01:21 ? 00:00:00 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id 66d1f69a65a1e056cd943aaea92fe761c57dc8b41dd6ae12676bc47b0dfdef23 -address /run/containerd/containerd.sock root 297 1 0 01:21 ? 00:00:00 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id fac6ebe22ca25ff939288745306ddc0a10c20dbd9875d4165eac9316be183c40 -address /run/containerd/containerd.sock root 317 1 0 01:21 ? 00:00:00 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id b4ceca7e4c7cab8f363a25c26ba6c2ba41570b778e7c07f7728d5d80cb1e222d -address /run/containerd/containerd.sock root 331 280 0 01:21 ? 00:00:00 /pause root 369 297 0 01:21 ? 00:00:00 /pause root 379 1 0 01:21 ? 00:00:00 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id fdfb2d6c2ff48980c0387c578477bef6a1a6a21e3f6d5c39c598fce959b30a8c -address /run/containerd/containerd.sock root 382 317 0 01:21 ? 00:00:00 /pause root 420 379 0 01:21 ? 00:00:00 /pause root 463 317 1 01:21 ? 00:00:29 kube-controller-manager --allocate-node-cidrs=true --authentication-kubeconfig=/etc/kubernetes/controller-manager.conf --authorization-kubeconfig=/etc/kubernetes/controller-manager.conf --bind-address=12 root 500 280 5 01:21 ? 00:01:41 kube-apiserver --advertise-address=172.18.0.4 --allow-privileged=true --authorization-mode=Node,RBAC --client-ca-file=/etc/kubernetes/pki/ca.crt --enable-admission-plugins=NodeRestriction --enable-bootst root 522 379 0 01:21 ? 00:00:09 kube-scheduler --authentication-kubeconfig=/etc/kubernetes/scheduler.conf --authorization-kubeconfig=/etc/kubernetes/scheduler.conf --bind-address=127.0.0.1 --kubeconfig=/etc/kubernetes/scheduler.conf -- root 559 297 2 01:21 ? 00:00:49 etcd --advertise-client-urls=https://172.18.0.4:2379 --cert-file=/etc/kubernetes/pki/etcd/server.crt --client-cert-auth=true --data-dir=/var/lib/etcd --initial-advertise-peer-urls=https://172.18.0.4:2380 root 601 1 2 01:21 ? 00:00:47 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runti root 687 1 0 01:22 ? 00:00:00 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id 97a4af0d01714ef45d223eaeea315316a01bff53916dc45627b18441672098e3 -address /run/containerd/containerd.sock root 706 687 0 01:22 ? 00:00:00 /pause root 728 1 0 01:22 ? 00:00:00 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id 571b39bdfdddb0fa8ac8f605b74765292455bddcce45e7ffe9f744e97218aedd -address /run/containerd/containerd.sock root 749 728 0 01:22 ? 00:00:00 /pause root 786 728 0 01:22 ? 00:00:00 /bin/kindnetd root 807 687 0 01:22 ? 00:00:01 /usr/local/bin/kube-proxy --config=/var/lib/kube-proxy/config.conf --hostname-override=kind-control-plane root 3463 0 0 01:54 pts/1 00:00:00 bash root 3483 3463 0 01:54 pts/1 00:00:00 ps -aef root@kind-control-plane:/#