k0s

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

README

k0s Runtime Design

basefs

.
├── amd64
│   ├── bin
│   │   ├── k0s
│   │   ├── kubectl
│   │   ├── nerdctl
│   │   └── seautil
│   ├── images
│   │   └── registry.tar.gz
│   └── Metadata
├── imageList
├── Kubefile
└── rootfs
    ├── etc
    │   ├── dump-config.toml
    │   └── registry.yml
    └── scripts
        ├── containerd.sh
        ├── init-registry.sh
        └── init.sh

introduce

We define the k0s runtime has 5 phases to install/scale/reset the cluster.

basefs contains binary、shell script、config file and image. See more about sealerio/basefs

Runtime before filesystem lead cluster install through execute k0s command.

  • Init
    • When sealer leads to cluster install first, init phase copy rootfs/bin to /usr/bin in init.sh script
    • create bootstrap config /etc/k0s/k0s.yaml to lead controller init
    • generate k0s join token /etc/k0s/worker-token and /etc/k0s/controller-token, also private registry cert
    • init controller node
    • fetch config for ~/.kube/config to manage the cluster.
  • Join
    • Join phase prepare the registry certs, and use k0s join to scale up the cluster.
  • Delete
    • Delete is same as join, but it recycles anything installed by join phase.
  • Reset
    • Reset through k0s to remove this cluster and remove anything about the cluster generated by sealer.
  • Upgrade
    • Coming for soon!

Documentation

Index

Constants

View Source
const (
	DefaultAdminConfPath = "/var/lib/k0s/pki/admin.conf"

	DefaultK0sConfigPath     = "/etc/k0s/k0s.yaml"
	DefaultK0sWorkerJoin     = "/etc/k0s/worker"
	DefaultK0sControllerJoin = "/etc/k0s/controller"
	WorkerRole               = "worker"
	ControllerRole           = "controller"

	ExternalCRIAddress = "remote:/run/containerd/containerd.sock"
)
View Source
const TimeForWaitingK0sStart = 10
View Source
const WaitingFork0sServiceStartTimes = 5

Variables

This section is empty.

Functions

func GetClientFromConfig added in v0.9.2

func GetClientFromConfig(adminConfPath string) (runtimeClient.Client, error)

func NewK0sRuntime

func NewK0sRuntime(infra infradriver.InfraDriver, containerRuntimeInfo containerruntime.Info, registryInfo registry.Info) (runtime.Installer, error)

NewK0sRuntime gen a k0s bootstrap process that leading k0s cluster management

func NewKubeDriver added in v0.9.2

func NewKubeDriver(kubeConfig string) (runtime.Driver, error)

Types

type Runtime

type Runtime struct {
	Vlog int
	// contains filtered or unexported fields
}

Runtime struct is the runtime interface for k0s

func (*Runtime) CopyJoinToken

func (k *Runtime) CopyJoinToken(role string, hosts []net.IP) error

func (*Runtime) GetCurrentRuntimeDriver added in v0.9.2

func (k *Runtime) GetCurrentRuntimeDriver() (runtime.Driver, error)

func (*Runtime) Install added in v0.9.2

func (k *Runtime) Install() error

func (*Runtime) JoinCommand

func (k *Runtime) JoinCommand(role, registryInfo string) []string

func (*Runtime) Reset

func (k *Runtime) Reset() error

func (*Runtime) ScaleDown added in v0.9.2

func (k *Runtime) ScaleDown(mastersToDelete, workersToDelete []net.IP) error

func (*Runtime) ScaleUp added in v0.9.2

func (k *Runtime) ScaleUp(newMasters, newWorkers []net.IP) error

func (*Runtime) Upgrade

func (k *Runtime) Upgrade() error

func (*Runtime) WaitK0sReady

func (k *Runtime) WaitK0sReady(host net.IP) error

func (*Runtime) WaitSSHReady

func (k *Runtime) WaitSSHReady(tryTimes int, hosts ...net.IP) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL