Embedded kubernetes is lightweight Kubernetes distributions for development and edge.
1# K3s: lightweight Kubernetes2curl -sfL https://get.k3s.io | sh -34# MicroK8s: from Canonical5snap install microk8s --classic67# Check8kubectl get nodes9kubectl get pods -A1011# Go client for management12go get k8s.io/client-go13go get k8s.io/apimachinery
1// Go program for managing k3s2package main34import (5 "context"6 "fmt"7 "k8s.io/client-go/kubernetes"8 "k8s.io/client-go/tools/clientcmd"9)1011func main() {12 // K3s uses the same kubeconfig13 config, err := clientcmd.BuildConfigFromFlags("",14 "/etc/rancher/k3s/k3s.yaml")15 if err != nil {16 log.Fatal(err)17 }1819 clientset, _ := kubernetes.NewForConfig(config)2021 // Works like regular Kubernetes22 pods, _ := clientset.CoreV1().Pods("").List(23 context.Background(),24 metav1.ListOptions{},25 )2627 for _, pod := range pods.Items {28 fmt.Printf("Pod: %s/%s\n", pod.Namespace, pod.Name)29 }30}
Comparison: