Ubuntu使用kind快速搭建k8s的Learning environment

KVMandDock

从上图可以看出什么来吗?

kind,kubernetes in docker。kind基于 Docker 而不是虚拟化(对比Minikube),不是打包一个虚拟化镜像,而是直接将k8s 组件运行在 Docker。

带来了什么好处呢?

  1. 不需要运行 GuestOS 占用资源更低。
  2. 不基于虚拟化技术,可以在 VM 中使用。
  3. 文件更小,更利于移植。

NOTE:kind does not require kubectl,but you will not be able to perform some of the examples in our docs without it。

kubectl:The Kubernetes command-line tool,allows you to run commands against Kubernetes clusters。You can use kubectl to deploy applications,inspect and manage cluster resources,and view logs。

继续上kind的运行架构图,加深理解

我的主机环境:


 

步骤一、安装Docker 

Step 1: 更换国内软件源

Step 2: 安装必要工具

sudo apt-get install apt-transport-https ca-certificates software-properties-common curl

Step 3: 安装GPG证书(密钥),并且添加Docker-ce软件源信息

官方源(很慢不推荐):

curl -fsSL https://download.docker.com/linux/ubuntu/gpg|sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

阿里云软件源(推荐)

curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

Step 4: 更新并安装Docker-ce

sudo apt-get update
sudo apt-get install docker-ce

Step 5: 测试运行

sudo docker run hello-world

Step 6: 将当前用户添加到 docker 组,可以不用sudo运行docker

# 将当前用户添加到 docker 组
sudo gpasswd -a ${USER} docker

# 重新登录或者用以下命令切换到docker组
newgrp - docker

# 重启docker服务
sudo service docker restart

# 不加sudo直接执行docker命令检查效果
docker ps

步骤二、安装kubectl(可选)

snap install kubectl --classic

# 查看kubectl版本
kubectl version --client

步骤二、安装kind

curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.10.0/kind-linux-amd64
chmod +x ./kind

# 我把kind给mv到${HOME}/.local/bin了
mv ./kind /some-dir-in-your-PATH/kind

创建一个单节点的k8s环境

kind create cluster

创建成功

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Linux has come a long way in a short time. Computing itself is still relatively young by any standard; if the era of modern computing started with the invention of the microchip, it’s still less than 50 years old. But Linux is a youngster compared even to this; it has been around for only 17 of those years. In that brief time span, a student’s personal project has grown to where it now runs many computers throughout the world. It has rampaged through the computing industry, providing an alternative to commercial solutions such as those offered by Microsoft, and toppling longheld beliefs about the way things should be done. This is all by virtue of the fact that Linux is simply better than every other choice out there. Many argue that it’s more secure and faster than other operating systems. But here’s the kicker—Linux is free of charge. Yes, that’s right. It doesn’t have to cost a penny. It is one of the computing industry’s best-kept secrets. I was bitten by the Linux bug in the mid-1990s. I was introduced to it by a friend who sold it to me as a kind of alternative to DOS. At that time, I typed a few commands at the prompt and was greeted by error messages. I must admit that I was put off. But shortly afterwards, I revisited Linux and quickly became hooked. Yet getting used to Linux wasn’t easy. I read as many books as I could, but they weren’t very helpful to me. They were usually overly complicated or simply irrelevant. To start off, I didn’t want to know how to create a program that could parse text files. I just wanted to know how to copy and delete files. I didn’t want to set up a web server. I just wanted to know how to play my MP3 tracks and browse the Web. This book is my answer to the need for a fundamental, authoritative, and down-toearth guide to Linux, done in the context of one of the most popular flavors of Linux in existence today. It’s a book that is desperately needed in our modern world, especially as Linux becomes more and more popular and enters homes and workplaces. Beginning Ubuntu Linux, Third Edition purely and simply focuses on what you need to know to use Linux. It’s concise and to the point, aiming to re-create under Linux all the stuff you used to do under Windows, or even Apple Macintosh. But don’t think that this means Beginning Ubuntu Linux, Third Edition cuts corners. Wherever justified, this book spends time examining the topics you need to know in order to gain a complete and comprehensive understanding. For example, you’ll find a hefty chapter looking at the command-line prompt—arguably the heart of Linux and the element that gives Linux most of its power. There’s also an entire chapter discussing (and illustrating) how to initially install Ubuntu on your computer. Beginning Ubuntu Linux, Third Edition really is a complete guide.
要在Ubuntu 22.04上搭建Kubernetes集群,可以使用kubeadm工具进行快速部署。首先,需要准备好虚拟机,并确保每个节点的系统配置满足最低要求,如CPU核心不低于2个,RAM不低于2G。\[1\] 在开始之前,需要进行环境配置。可以使用以下命令来安装Docker和containerd作为容器运行时: ``` $ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg ``` 接下来,可以使用kubeadm工具来部署Kubernetes集群。具体的安装步骤和配置文件可以在文章末尾的网盘中找到。\[1\] 请注意,从Kubernetes 1.24版本开始,Dockershim已从Kubernetes项目中移除,因此我们将使用containerd作为容器运行时。\[3\] 希望这些信息对您有帮助,如果您需要更详细的步骤和配置,请参考提供的引用内容。 #### 引用[.reference_title] - *1* [Ubuntu22.04部署Kubernetes集群(亲测可用)](https://blog.csdn.net/qq_43347021/article/details/129815123)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Ubuntu22.04部署K8S1.27.2版本集群](https://blog.csdn.net/sgj584520/article/details/130954363)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [Ubuntu22.04搭建k8s集群,看这一篇就够啦!](https://blog.csdn.net/m0_43445928/article/details/130524917)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wsdhla

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值