试验KIND
今天试验了一把 才真正明白 ,KIND 是 k8s in docker的意思, 还有DIND,前端时间在 实验楼的 环境里,他们就是用KIND的环境,当时看得很晕!
yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
service docker start
安装 kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/amd64/kubectl
cp ./kubectl /usr/bin/kubectl
chmod +x /usr/bin/kubectl
kind: Cluster
#apiVersion: kind.sigs.k8s.io/v1alpha
apiVersion: kind.x-k8s.io/v1alpha4
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
metadata:
name: config
networking:
serviceSubnet: 10.0.0.0/16
- |
apiVersion: kubeadm.k8s.io/v1beta2
kind: InitConfiguration
metadata:
name: config
networking:
serviceSubnet: 10.0.0.0/16
nodes:
- role: control-plane
- role: control-plane
- role: control-plane
- role: worker
- role: worker
- role: worker
./kind create cluster --name mycluster --config kind-config.yaml
after created:
kubectl get nodes
NAME STATUS ROLES AGE VERSION
mycluster-control-plane Ready master 76m v1.19.1
mycluster-control-plane2 Ready master 76m v1.19.1
mycluster-control-plane3 Ready master 75m v1.19.1
mycluster-worker Ready <none> 74m v1.19.1
mycluster-worker2 Ready <none> 74m v1.19.1
mycluster-worker3 Ready <none> 74m v1.19.1
kubectl get pod -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-system coredns-f9fd979d6-5p74t 1/1 Running 0 77m 10.244.0.3 mycluster-control-plane <none> <none>
kube-system coredns-f9fd979d6-pzm4s 1/1 Running 0 77m 10.244.0.2 mycluster-control-plane <none> <none>
kube-system etcd-mycluster-control-plane 1/1 Running 0 77m 172.18.0.8 mycluster-control-plane <none> <none>
kube-system etcd-mycluster-control-plane2 1/1 Running 0 77m 172.18.0.5 mycluster-control-plane2 <none> <none>
kube-system etcd-mycluster-control-plane3 1/1 Running 0 74m 172.18.0.6 mycluster-control-plane3 <none> <none>
kube-system kindnet-7pz2b 1/1 Running 0 75m 172.18.0.4 mycluster-worker <none> <none>
kube-system kindnet-g66nf 1/1 Running 0 77m 172.18.0.8 mycluster-control-plane <none> <none>
kube-system kindnet-n462t 1/1 Running 0 77m 172.18.0.5 mycluster-control-plane2 <none> <none>
kube-system kindnet-tb2gn 1/1 Running 0 76m 172.18.0.6 mycluster-control-plane3 <none> <none>
kube-system kindnet-w9t8k 1/1 Running 0 75m 172.18.0.7 mycluster-worker3 <none> <none>
kube-system kindnet-z6dn5 1/1 Running 0 75m 172.18.0.3 mycluster-worker2 <none> <none>
kube-system kube-apiserver-mycluster-control-plane 1/1 Running 0 77m 172.18.0.8 mycluster-control-plane <none> <none>
kube-system kube-apiserver-mycluster-control-plane2 1/1 Running 0 77m 172.18.0.5 mycluster-control-plane2 <none> <none>
kube-system kube-apiserver-mycluster-control-plane3 1/1 Running 1 75m 172.18.0.6 mycluster-control-plane3 <none> <none>
kube-system kube-controller-manager-mycluster-control-plane 1/1 Running 1 77m 172.18.0.8 mycluster-control-plane <none> <none>
kube-system kube-controller-manager-mycluster-control-plane2 1/1 Running 0 77m 172.18.0.5 mycluster-control-plane2 <none> <none>
kube-system kube-controller-manager-mycluster-control-plane3 1/1 Running 0 75m 172.18.0.6 mycluster-control-plane3 <none> <none>
kube-system kube-proxy-9572f 1/1 Running 0 77m 172.18.0.8 mycluster-control-plane <none> <none>
kube-system kube-proxy-9cnzb 1/1 Running 0 77m 172.18.0.5 mycluster-control-plane2 <none> <none>
kube-system kube-proxy-b25jk 1/1 Running 0 76m 172.18.0.6 mycluster-control-plane3 <none> <none>
kube-system kube-proxy-cbbks 1/1 Running 0 75m 172.18.0.3 mycluster-worker2 <none> <none>
kube-system kube-proxy-gwgfc 1/1 Running 0 75m 172.18.0.7 mycluster-worker3 <none> <none>
kube-system kube-proxy-t54vs 1/1 Running 0 75m 172.18.0.4 mycluster-worker <none> <none>
kube-system kube-scheduler-mycluster-control-plane 1/1 Running 1 77m 172.18.0.8 mycluster-control-plane <none> <none>
kube-system kube-scheduler-mycluster-control-plane2 1/1 Running 0 77m 172.18.0.5 mycluster-control-plane2 <none> <none>
kube-system kube-scheduler-mycluster-control-plane3 1/1 Running 0 75m 172.18.0.6 mycluster-control-plane3 <none> <none>
local-path-storage local-path-provisioner-78776bfc44-hwts4 1/1 Running 0 77m 10.244.0.4 mycluster-control-plane
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3dda4e2739f0 kindest/haproxy:v20200708-548e36db "/docker-entrypoint.…" About an hour ago Up About an hour 127.0.0.1:41129->6443/tcp mycluster-external-load-balancer
4522814b58ac kindest/node:v1.19.1 "/usr/local/bin/entr…" About an hour ago Up About an hour 127.0.0.1:46215->6443/tcp mycluster-control-plane2
d10df766533c kindest/node:v1.19.1 "/usr/local/bin/entr…" About an hour ago Up About an hour mycluster-worker
df0dabd869aa kindest/node:v1.19.1 "/usr/local/bin/entr…" About an hour ago Up About an hour mycluster-worker2
ad7f0150d16e kindest/node:v1.19.1 "/usr/local/bin/entr…" About an hour ago Up About an hour 127.0.0.1:34819->6443/tcp mycluster-control-plane3
fd59758441fb kindest/node:v1.19.1 "/usr/local/bin/entr…" About an hour ago Up About an hour 127.0.0.1:38195->6443/tcp mycluster-control-plane
6fc452427280 kindest/node:v1.19.1 "/usr/local/bin/entr…" About an hour ago Up About an hour mycluster-worker3
5b9d40ac9f06 kindest/node:v1.19.1 "/usr/local/bin/entr…" 2 hours ago Up 2 hours 127.0.0.1:39477->6443/tcp kind-control-plane
- 点赞
- 收藏
- 关注作者
评论(0)