Kind 安装 kubernets集群

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 换源

shell 复制代码
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

shell 复制代码
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/

shell 复制代码
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

创建

  1. create 一个 kubernetes 集群

    shell 复制代码
    kind create cluster --name sca-k8s-cluster
  2. 检测集群的健康状态

    shell 复制代码
    kubectl cluster-info --context kind-sca-k8s-cluster

    输出以下结果则表示创建成功。

    shell 复制代码
    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
相关推荐
我不会起名字32213 小时前
eBPF 与 perf 性能观测:On-CPU、Off-CPU 火焰图与内核探针的 4 个边界
linux·云原生·ebpf·perf·性能观测
阿里云云原生13 小时前
阿里云三大新发布,开源、新品、升级
云原生
阿里云云原生13 小时前
运维团队的新同事来了:STAROps 7 位数字专家亮相
云原生
阿里云云原生14 小时前
别再替 Agent 找工具了:Nacos Agent Plugin 让它自己找
云原生
一水鉴天15 小时前
统筹表和三型条目(梯子/轮子/旗子) - 豆包 20261102
人工智能·云原生·架构
阿里云云原生15 小时前
SLS 数据语义效果评测:有了语义模型,Agent 能答得更准吗?
云原生
阿里云云原生16 小时前
阿里云百炼推出正式版决策模型,HiRoute 实测超越 OpenAI Decisions
云原生
阿里云云原生16 小时前
码上 2027丨阿里云 AgentCore 邀你造世界
云原生
长不大的杨瑞杰19 小时前
Kubernetes CrashLoopBackOff 排障全流程:OOM、探针、应用退出与依赖故障定责
docker·云原生·容器·kubernetes·devops·oomkilled
TiDB 社区干货传送门20 小时前
平凯 Loop 开放 PaaS 原子能力,破解企业级多智能体“底层困局”
云原生·云计算·paas