Howto k0s: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
Line 8: Line 8:
  k0s default-config > ./k0s.yaml
  k0s default-config > ./k0s.yaml
edit the following settings:
edit the following settings:
apiVersion: k0s.k0sproject.io/v1beta1
  kind: ClusterConfig
  kind: ClusterConfig
  metadata:
  metadata:
Line 26: Line 25:
       - name: ingress-nginx
       - name: ingress-nginx
         url: https://kubernetes.github.io/ingress-nginx
         url: https://kubernetes.github.io/ingress-nginx
       - name: metallb
       - name: traefik
         url: https://metallb.github.io/metallb
         url: https://traefik.github.io/charts
      - name: bitnami
        url: https://charts.bitnami.com/bitnami
       charts:
       charts:
       - name: ingress-nginx
       - name: ingress-nginx
         chartname: ingress-nginx/ingress-nginx
         chartname: ingress-nginx/ingress-nginx
         version: "4.10.1"
         namespace: kube-system
      - name: traefik
        chartname: traefik/traefik
         namespace: kube-system
         namespace: kube-system
       - name: metallb
       - name: metallb
         chartname: metallb/metallb
         chartname: bitnami/metallb
        version: "0.14.5"
         namespace: kube-system
         namespace: kube-system
         values: |
         values: |

Revision as of 00:42, 18 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:

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

references