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
相关推荐
SelectDB10 小时前
秒级弹性、最高降本 70%:SelectDB Serverless 如何重塑云数仓资源效率
大数据·后端·云原生
秋播3 天前
国内本地WSL2编译rancher源码
云原生
小猿姐4 天前
MySQL Top 10 热点问题 AI 运维实战:从内核诊断到云原生运维
mysql·云原生·aiops
阿里云云原生5 天前
深入内核:拆解 OpenTelemetry eBPF 探针如何优雅地“透视”多语言微服务?
云原生
java_cj6 天前
深入kube-apiserver认证机制:从Bearer Token到mTLS的完整认证链解析
linux·运维·服务器·云原生·容器·kubernetes
互联网推荐官6 天前
上海软件定制开发公司推荐:从PaaS工程化路径看D-coding的技术取舍
云原生·云计算·paas·软件开发·开发经验·上海
sbjdhjd6 天前
从零搭建企业级 CI/CD(下):Jenkins+GitLab+Harbor 全链路实战指南
git·servlet·ci/cd·云原生·云计算·gitlab·jenkins
java_cj6 天前
深入kubectl create源码:从YAML到Pod的完整链路拆解
运维·云原生·容器·kubernetes
步步为营DotNet6 天前
基于.NET Aspire 实现云原生应用的高效监控与可观测性
云原生·.net·wpf
牛奶咖啡136 天前
KVM虚拟化与企业应用实践——给远端主机创建虚拟机
云原生·qemu·kvm·给远端主机创建虚拟机·创建uefi模式的虚拟机·安装openeulersp2·vnc与虚拟机环境搭建