Howto k0s
installation
on archlinux use yay:
yay -S k0s-bin
on other distros:
curl -sSLf https://get.k0s.sh | sudo sh
edit config
export default config to file:
k0s default-config > ./k0s.yaml
edit the following settings:
kind: ClusterConfig metadata: creationTimestamp: null name: k0s spec: api: address: 192.168.75.2 k0sApiPort: 9443 port: 6443 sans: - 192.168.75.2 controllerManager: {} extensions: helm: repositories: - name: ingress-nginx url: https://kubernetes.github.io/ingress-nginx - name: traefik url: https://traefik.github.io/charts - name: bitnami url: https://charts.bitnami.com/bitnami charts: - name: ingress-nginx chartname: ingress-nginx/ingress-nginx namespace: kube-system - name: traefik chartname: traefik/traefik namespace: kube-system - name: metallb chartname: bitnami/metallb namespace: kube-system values: | configInline: address-pools: - name: generic-cluster-pool protocol: layer2 addresses: - 192.168.75.20-192.168.75.25 storage: create_default_storage_class: false type: external_storage installConfig: users: etcdUser: etcd kineUser: kube-apiserver konnectivityUser: konnectivity-server kubeAPIserverUser: kube-apiserver kubeSchedulerUser: kube-scheduler konnectivity: adminPort: 8133 agentPort: 8132 network: calico: null clusterDomain: cluster.local dualStack: {} kubeProxy: iptables: minSyncPeriod: 0s syncPeriod: 0s ipvs: minSyncPeriod: 0s syncPeriod: 0s tcpFinTimeout: 0s tcpTimeout: 0s udpTimeout: 0s metricsBindAddress: 0.0.0.0:10249 mode: iptables kuberouter: autoMTU: true hairpin: Enabled ipMasq: false metricsPort: 8080 mtu: 0 peerRouterASNs: "" peerRouterIPs: "" nodeLocalLoadBalancing: envoyProxy: apiServerBindPort: 7443 konnectivityServerBindPort: 7132 type: EnvoyProxy podCIDR: 10.244.0.0/16 provider: calico serviceCIDR: 10.96.0.0/12 scheduler: {} storage: etcd: externalCluster: null peerAddress: 192.168.75.2 type: etcd telemetry: enabled: true
install single node cluster
iniciate installation:
k0s install controller -c k0s.yaml --single --no-taints k0s start
verify status:
k0s status
verify node status:
k0s kubectl get nodes
watch container creation:
watch k0s kubectl get po -A
copy kube admin credentials:
mkdir ~/.kube/ && cp /var/lib/k0s/pki/admin.conf ~/.kube/config
verify cluster pods status:
kubectl get po -A
uninstall
stop cluster:
k0s stop
reset configuration:
k0s reset
troubleshooting
if got the following error trying to create ingress rule:
"Internal error occurred: failed calling webhook \"validate.nginx.ingress.kubernetes.io\": failed to call webhook: Post \"https://nginx-ingress-ingress-nginx-controller-admission.default.svc:443/networking/v1/ingresses?timeout=10s\": x509: certificate signed by unknown authority"
do the following:
CA=$(oc get secrets -n kube-system ingress-nginx-admission -o jsonpath='{.data.ca}') oc patch validatingwebhookconfigurations ingress-nginx-admission --type='json' -p='[{"op": "add", "path": "/webhooks/0/clientConfig/caBundle", "value":"'$CA'"}]'