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
相关推荐
Marcel1116 小时前
WSL2使用Kind创建K8S集群时出现IPV6网络创建失败
云原生·kubernetes·kind
呱牛do it11 小时前
【系列专栏】银行IT的云原生架构-云单元架构 12
云原生·金融·架构
zxzy_org11 小时前
轻松上手:2025年微服务教程
算法·微服务·云原生·架构
power-辰南14 小时前
微服务线上发布稳定性解决方案
微服务·云原生·架构·无损上线·无损下线
ChinaRainbowSea15 小时前
14. Docker 轻量级可视化工具 Portainer(的详细安装步骤+常规使用详细说明)
java·运维·docker·云原生·容器
a_j5815 小时前
Kubernetes知识点总结(十)
云原生·容器·kubernetes
露临霜20 小时前
低代码系统-产品架构案例介绍、某PaaS(十四)
低代码·云原生·paas
企鹅侠客21 小时前
kubelet 中pleg 是用来解决什么问题?
java·云原生·kubelet
ghostwritten21 小时前
k8s集群如何赋权普通用户仅管理指定命名空间资源
云原生·容器·kubernetes
lil_侯昊1 天前
【进阶】微服务
微服务·云原生·架构