Kind 安装 kubernets
介绍
kind is a tool for running local Kubernetes clusters using Docker container “nodes”.
Kind 是一个通过使用 docker 容器模拟节点来创建本地 k8s 集群的工具。
repo:https://github.com/kubernetes-sigs/kind
website:https://kind.sigs.k8s.io/
快速开始
安装 Docker
因为 Kind 使用 docker 来模拟 kubernetes 集群,启动容器,因此首先需要安装 docker
Docker: https://docs.docker.com/get-docker/
Docker 换源
vim /etc/docker/deamo.json
# 写入以下内容
{
"registry-mirrors" : [
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
"https://cr.console.aliyun.com",
"https://mirror.ccs.tencentyun.com"
]
}
# 重启 docker
systemctl restart docker
安装 Kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.12.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/
如果下载失败,也可以手动下载之后上传到 linux 服务器中。
安装 Kubectl
https://kubernetes.io/zh-cn/docs/tasks/tools/install-kubectl-linux/
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
# 校验 (可跳过)
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
# 通过校验: kubectl: OK
# 安装
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
# 查看版本信息
kubectl version --client
kubectl version --client --output=yaml
创建
-
create 一个 kubernetes 集群
kind create cluster --name sca-k8s-cluster
-
检测集群的健康状态文章来源:https://www.toymoban.com/news/detail-818983.html
kubectl cluster-info --context kind-sca-k8s-cluster
输出以下结果则表示创建成功。文章来源地址https://www.toymoban.com/news/detail-818983.html
root@yuluo-machine:~# kubectl cluster-info --context kind-sca-k8s-cluster Kubernetes control plane is running at https://127.0.0.1:44623 CoreDNS is running at https://127.0.0.1:44623/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. root@yuluo-machine:~# kubectl get pod -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-5d78c9869d-vpphj 1/1 Running 0 11m kube-system coredns-5d78c9869d-zpmhj 1/1 Running 0 11m kube-system etcd-sca-k8s-cluster-control-plane 1/1 Running 0 11m kube-system kindnet-lmdnv 1/1 Running 0 11m kube-system kube-apiserver-sca-k8s-cluster-control-plane 1/1 Running 0 11m kube-system kube-controller-manager-sca-k8s-cluster-control-plane 1/1 Running 0 11m kube-system kube-proxy-sc879 1/1 Running 0 11m kube-system kube-scheduler-sca-k8s-cluster-control-plane 1/1 Running 0 11m local-path-storage local-path-provisioner-6bc4bddd6b-p9rjn 1/1 Running 0 11m
到了这里,关于Kind 安装 kubernets集群的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!