Documentation
¶
Overview ¶
Package k3s handles K3s installation, cluster join, and lifecycle management on remote Lima VMs.
Index ¶
- type Manager
- func (m *Manager) CreateSnapshot(ctx context.Context) (string, error)
- func (m *Manager) DeleteNode(ctx context.Context, nodeName string) error
- func (m *Manager) DownloadSnapshot(ctx context.Context, remotePath, localPath string) error
- func (m *Manager) DrainNode(ctx context.Context, nodeName string) error
- func (m *Manager) GetKubeconfig(ctx context.Context, serverIP string) (string, error)
- func (m *Manager) GetNodeStatus(ctx context.Context) (string, error)
- func (m *Manager) GetToken(ctx context.Context) (string, error)
- func (m *Manager) GetVersion(ctx context.Context) (string, error)
- func (m *Manager) InitCluster(ctx context.Context, nodeIP, pool, k3sVersion string, tlsSANs []string) error
- func (m *Manager) IsInstalled(ctx context.Context) (bool, error)
- func (m *Manager) JoinAgent(ctx context.Context, nodeIP, serverURL, token, pool, k3sVersion string) error
- func (m *Manager) JoinServer(ctx context.Context, nodeIP, serverURL, token, pool, k3sVersion string, ...) error
- func (m *Manager) ReinstallAgent(ctx context.Context, nodeIP, serverURL, token, version, pool string) error
- func (m *Manager) ReinstallJoinServer(ctx context.Context, nodeIP, serverURL, token, version, pool string) error
- func (m *Manager) ReinstallServer(ctx context.Context, nodeIP, version string, tlsSANs []string, pool string) error
- func (m *Manager) RestoreSnapshot(ctx context.Context, snapshotPath string) error
- func (m *Manager) StartService(ctx context.Context) error
- func (m *Manager) StopService(ctx context.Context) error
- func (m *Manager) UncordonNode(ctx context.Context, nodeName string) error
- func (m *Manager) Uninstall(ctx context.Context, role string) error
- func (m *Manager) UploadSnapshot(ctx context.Context, localPath, remotePath string) error
- func (m *Manager) WaitForReady(ctx context.Context, timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles K3s operations on a remote Lima VM.
func NewManager ¶
NewManager creates a new K3s manager for the given remote host.
func NewManagerWithVM ¶
NewManagerWithVM creates a new K3s manager with a custom VM name.
func (*Manager) CreateSnapshot ¶
CreateSnapshot creates an etcd snapshot and returns the snapshot name/path.
func (*Manager) DeleteNode ¶
DeleteNode removes a node from the cluster.
func (*Manager) DownloadSnapshot ¶
DownloadSnapshot copies a snapshot from the remote VM to the local machine.
func (*Manager) GetKubeconfig ¶
GetKubeconfig retrieves and patches the kubeconfig for external access.
func (*Manager) GetNodeStatus ¶
GetNodeStatus returns the output of kubectl get nodes.
func (*Manager) GetVersion ¶
GetVersion returns the installed K3s version string.
func (*Manager) InitCluster ¶
func (m *Manager) InitCluster(ctx context.Context, nodeIP, pool, k3sVersion string, tlsSANs []string) error
InitCluster bootstraps the first control plane node with --cluster-init.
func (*Manager) IsInstalled ¶
IsInstalled checks whether K3s is installed inside the VM.
func (*Manager) JoinAgent ¶
func (m *Manager) JoinAgent(ctx context.Context, nodeIP, serverURL, token, pool, k3sVersion string) error
JoinAgent joins a worker node to the cluster.
func (*Manager) JoinServer ¶
func (m *Manager) JoinServer(ctx context.Context, nodeIP, serverURL, token, pool, k3sVersion string, tlsSANs []string) error
JoinServer joins a server node to an existing HA cluster.
func (*Manager) ReinstallAgent ¶
func (m *Manager) ReinstallAgent(ctx context.Context, nodeIP, serverURL, token, version, pool string) error
ReinstallAgent reinstalls K3s on an agent node.
func (*Manager) ReinstallJoinServer ¶
func (m *Manager) ReinstallJoinServer(ctx context.Context, nodeIP, serverURL, token, version, pool string) error
ReinstallJoinServer reinstalls K3s on a server node that joins an existing cluster.
func (*Manager) ReinstallServer ¶
func (m *Manager) ReinstallServer(ctx context.Context, nodeIP, version string, tlsSANs []string, pool string) error
ReinstallServer reinstalls K3s server (init node) with a new version.
func (*Manager) RestoreSnapshot ¶
RestoreSnapshot restores etcd from a snapshot file on the remote VM.
func (*Manager) StartService ¶
StartService starts the K3s systemd service.
func (*Manager) StopService ¶
StopService stops the K3s systemd service.
func (*Manager) UncordonNode ¶
UncordonNode marks a node as schedulable after draining.
func (*Manager) UploadSnapshot ¶
UploadSnapshot copies a snapshot from the local machine to the remote VM.