第9节 sealer runtime Stage 2 (including biweekly meetings)


❤️💕💕记录sealosopen in new window开源项目的学习过程。k8s,docker和云原生的学习open in new window。Myblog:http://nsddd.topopen in new window


[TOC]

code module

ISSUES 1859

feature] want to implement the k3s runtime moduleopen in new window#1859

3293172751open in new window opened this issue 前天 · 4 comments

What a good start @3293172751open in new window! Now i have some suggestions maybe make you more understand about sealer runtime.

the Achieve Interface step is definitely correct. but it would be some misunderstand about k3s's cluterimage rootfs in your chapter k3s - rootfs , i think we do not need to care too much about k3s install package distribution in this stage. I propose a step which is my learning path of sealer,FYI @3293172751open in new window .

  • k8s runtiem interface 逻辑是什么?
  • sealer 如何以及何时安装私人注册表?
  • runtime module 如何与 rootfs 中的脚本交互?

k3s module

ISSUE

And you mentioned about the k3s installation [online\offline]. I have little confusions. If sqlite couldn't support cluster HA installation? How to specify the database? Another question is about install step. AFAIK, k3s support join node by k3s agent k3s server, so whether you tried this method? Last, k3s support custom private registry, how to config this? and whether k3s could support external CRI? @3293172751open in new window

最后,k3s支持自定义私有注册表,如何配置?k3是否可以支持外部CRI?

🎉about [online\offline]

🎉 about HA install and single node

⚠️ k3s discussions 6478open in new window 一些答疑和讨论~

k8s runtiem interface 逻辑是什么?

关于设计统一的interface

希望在接口 interface层实现各个模块的功能,统一暴露出去:

seal run k3s~
seal run k0s~
seal run kuberntes~

作者

另一个问题是关于安装步骤。AFAIK,k3s 支持通过 k3s 代理 k3s 服务器加入节点吗? 最后,k3s支持自定义私有registry,这个怎么配置?k3s能不能支持外部CRI?

k3s支持通过 k3s agent k3s server 加入节点吗?是的,k3s agent节点可以加入另一个正在运行的节点的集群k3s server。这就是你想问的吗?k3s 支持自定义私有注册中心,

如何配置?您有机会查看文档吗?https://docs.k3s.io/installation/private-registryk3s

可以支持外部 CRI 吗?是的,使用 --docker--container-runtime-endpoint。上面提到的 registries.yaml 支持仅适用于嵌入式 containerd;如果您自带 CRI,则由您自行正确配置。

注册表

// GenerateCert generate the containerd CA for registry TLS and k0s join token for 100 years.
func (k *Runtime) GenerateCert() error {
	if err := k.generateK0sToken(); err != nil {
		return err
	}
	if err := k.GenerateRegistryCert(); err != nil {
		return err
	}
	return k.SendRegistryCert(k.cluster.GetMasterIPList()[:1])
}

rootfs交互

runtime:

func (k *Runtime) initRegistryCmd() string {
	return fmt.Sprintf("cd %s/scripts && ./init-registry.sh %s %s %s", k.getRootfs(), k.RegConfig.Port, fmt.Sprintf("%s/registry", k.getRootfs()), k.RegConfig.Domain)
}

// getRootfs return the rootfs dir like: /var/lib/sealer/data/my-k0s-cluster/rootfs
func (k *Runtime) getRootfs() string {
	return common.DefaultTheClusterRootfsDir(k.cluster.Name)
}

//common
func DefaultTheClusterRootfsDir(clusterName string) string {
	return filepath.Join(DefaultSealerDataDir, clusterName, "rootfs")
}

DefaultSealerDataDir          = "/var/lib/sealer/data"

END 链接