Howto k0s: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
Line 106: Line 106:
verify node status:
verify node status:
  k0s kubectl get nodes
  k0s kubectl get nodes
watch container creation:
watch k0s kubectl get po -A
copy kube admin credentials:
copy kube admin credentials:
  mkdir ~/.kube/ && cp /var/lib/k0s/pki/admin.conf ~/.kube/config
  mkdir ~/.kube/ && cp /var/lib/k0s/pki/admin.conf ~/.kube/config
verify cluster pods status:
verify cluster pods status:
  kubectl get po -A
  kubectl get po -A
= uninstall =
= uninstall =
stop cluster:
stop cluster:

Revision as of 20:49, 17 May 2024

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:

apiVersion: k0s.k0sproject.io/v1beta1
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: metallb
        url: https://metallb.github.io/metallb
      charts:
      - name: ingress-nginx
        chartname: ingress-nginx/ingress-nginx
        version: "4.10.1"
        namespace: kube-system
      - name: metallb
        chartname: metallb/metallb
        version: "0.14.5"
        namespace: kube-system
        values: |2
          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

references