第4节 第一份设计稿
❤️💕💕记录sealos开源项目的学习过程。k8s,docker和云原生的学习。Myblog:http://nsddd.top
[TOC]
Before
- go test
- k3s / helm / K3s rootfs / docs / source codes /
- fabric
- spring boot – dockerfile
problem
cubxxw commented 2 days ago
k3s - github,I wonder if I need a tutorial on k3s.io,what should I pay attention to when I use it❓ Do I need to write the functions next to k8s to keep them together, or separate❓ @fanux
sealos run k0s:latest --masters xxx --nodes xxxx --passwd xxxx
cuisongliu commented yesterday
k3s - github,I wonder if I need a tutorial on k3s.io,what should I pay attention to when I use it❓ Do I need to write the functions next to k8s to keep them together, or separate❓
- runtime interface need spilt kubeadm and k3s
- k3s rootfs
controllers:
controllers
v:go1.18
cluster # 专门管理aws上k8s生命周期
ClusterSpec defines the desired state of InfraMetadata
rootfs runtime design
k3s rootfs
goolang 编译时会打包所有的依赖,每个独立的 binary 都会有独立的运行时支持
k3s把所有的依赖都编译在一个 binary
中,所有的程序 一份运行时
借鉴 rootfs (linux) 基于 buildroot 构建的 busybox rootfs
参考 rancher/k3s-root 所有的k3s 构建的 binary 都放在此处
/var/lib/rancher/k3s/data/..../bin
make Runtime module more readable
- k0s runtime
- k3s runtime
- k8s runtime
about:
util_test.go
file- implement runtime interface
- k3s runtime
implement runtime interface:
Interface
interface{}
runtime module list:
# runtime
+ kubernets
- kubeconfig.go #
- master.go
- node.go
- registry.go
- reset.go
- runtime_getter.go
- runtime.go
- static_files.go
- token.go
- update_cert.go
- utils.go
+ k3s
- add.go
- delete.go
- reset.go
- update.go
- token.go
+ k0s
k3s rootfs design:
init sealos
–> Clusterfile
file
merged:rootfs
root directory: /
❓
rootfs make build
rootfs interface
construction
How should rootfs build it?
bin cri etc images Kubefile opt README.md registry scripts statics
+ /bin
+ /etc
+ /images
+ /scripts
+ /tmp
+ /lib
+ /run
+ /var
为什么有些
merged
是空的
k3d
:要使用 Docker,rancher/k3s
还可以使用镜像来运行 K3s 服务器和代理。使用docker run
命令:
sealos run ranchar/k3s
sudo docker run \
-d --tmpfs /run \
--tmpfs /var/run \
-e K3S_URL=${SERVER_URL} \
-e K3S_TOKEN=${NODE_TOKEN} \
--privileged rancher/k3s:vX.Y.Z
the runtime module of k3s:
结构体方法:
- init方法
- SyncNodeIPVS 方法
- Init ⚠️
- SyncNodeIPVS ⚠️
sealos在基本的命令操作上可以理解为代替docker?
使用sealos run docker.io/rancher/k3s?
build k3s images ?
kubernetes 的构建方式
- helm
- sealos run ? -> merged(rootfs)
A simple question:
离线环境也需要 sealos ?
项目测试环境~(断点、单元测试、测试用例)
windows11
centos / ubuntu(内存不够)
vscode
I need solutions:
repeat images(auto cleaning)?
添加镜像列表:
sealos 会下载镜像列表中的镜像并缓存到 registry 目录。
目录必须形如
images/shim/[your image list filename]
:$ cat images/shim/nginxImages k8s.gcr.io/ingress-nginx/controller:v1.2.0 k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1
sealos 在构建的时候会自动添加镜像列表中的镜像依赖到集群镜像中,通过神奇的方式保存了里面依赖的 Docker 镜像。 并且在到别的环境中运行的时候更神奇的自动检测集群中想是否的 Docker 镜像,有的话自动下载,没有的话才会去 k8s.gcr.io 下载。 用户无需修改 helm chart 中的 docker 镜像地址,这里用到了镜像缓存代理的黑科技。
web :https://k8s.gcr.io/v2/ ?
**pull images registry❓ **
$ sealos login docker.io
$ sealos push docker.io/fanux/ingress-nginx:v1.2.0
sealos life cycle
:pod
sealos run == apply (pod / Deployment)
except
/var/lib/
,anything else?
My questions, suggestions?
sealos && docker : Invest time in docker
source code (kubernetes; k3s ….)
linux operating system source code
else
- Advice to developers (me)
…
END 链接
✴️版权声明 © :本书所有内容遵循CC-BY-SA 3.0协议(署名-相同方式共享)©