1

When I run kos kubectl get storageclass I notice it is not provisioned and I have to add it manually. I am little unsure though on the exact procedure. The [Documentation][https://docs.k0sproject.io/main/storage/] says k0s comes with OpenEBS installed. What I am unsure of is how to enable this extension in the config file.

My existing config file has this only (I assume this should be the default config file. Is this correct ?) :

spec:
  api:
    externalAddress

I have run k0s stop then amended the config file as follows:

spec:
  api:
    externalAddress
  extensions:
    storage:
      type: openebs_local_storage

After this config change I still get the same error they is no storageclass found for the cluster. Do I need to also reinstall/install k0s, am a bit unsure because the existing k0s.yaml seems to have very little config parameters as compared to the sample given in the link .

EDIT: Using Documentation I have proceeded to generate a new k0s.yaml that uses the existing default settings. Turns out it overwrites the existing k0s.yaml (given above) : I have also effected changes to the new yaml file to produce this :

apiVersion: k0s.k0sproject.io/v1beta1
kind: ClusterConfig
metadata:
  creationTimestamp: null
  name: k0s
spec:
  api:
    address: 10.XXX.XXX.XXX
    k0sApiPort: 9443
    port: 6443
    sans:
    - 10.XX.XX.XXX
    - 172.XX.XX.XXX
    - 10.XX.XX.XXX
    - 10.XX.XX.XXX
    - fe80::XXX:XXX:XXX:XXX
    - fe80::XXX:XXX:XXX:XXX
    - fe80::XXX:XXX:XXX:XXX
    - fe80::XXX:XXX:XXX:XXX
    - fe80::XXX:XXX:XXX:XXX
    - fe80::XXX:XXX:XXX:XXX
    tunneledNetworkingMode: false
  controllerManager: {}
  extensions:
    helm:
      charts: null
      repositories: null
    storage:
      create_default_storage_class: true
      type: openebs_local_storage
  images:
    calico:
      cni:
        image: docker.io/calico/cni
        version: v3.21.2
      kubecontrollers:
        image: docker.io/calico/kube-controllers

After this change I proceed to do a reinstall of the cluster (with the new config) :

k0s install controller -c /etc/k0s/k0s.yaml

but I am now getting an error :

Error: failed to install k0s service: failed to install service: Init already exists: /etc/systemd/system/k0scontroller.service
Golide
  • 113
  • 1
  • 9
  • Could you please give more details on your issue to reproduce it - do you use k0s on any cloud or on bare metal? – anarxz Feb 01 '22 at 14:59
  • Bare metal server Debian 10 – Golide Feb 04 '22 at 08:00
  • Im following this guide https://techviewleo.com/deploy-kubernetes-cluster-on-debian-using-k0s/ – Golide Feb 04 '22 at 08:00
  • @anarxz Suggestion is to do sudo systemctl restart k0scontroller . I have run this command but still k0s kubectl get storageclass returns No resources found – Golide Feb 06 '22 at 06:52

1 Answers1

1

I was able to reproduce your issue - in order to re-install the cluster with the new configuration for OpenEBS storage, you'll need to clean up your prior set-up:

  1. Stop the k0s service.
sudo k0s stop
  1. Reset previous installation that was done without your customized config file:
sudo k0s reset
  1. Re-install k0s with your new config file and with --enable-worker flag -> so that single node k0s with controller and worker functions will be installed again:
sudo k0s install controller --enable-worker -c /etc/k0s/k0s.yaml
  1. Start the k0s service:
sudo k0s start
  1. After a few seconds, check that two storage classes are enabled on the cluster for you to use:
sudo k0s kubectl get storageclass

The storage classes will have volumeBindingMode: WaitForFirstConsumer - meaning, that there is delay for volume binding until application pod is scheduled on the node.

anarxz
  • 186
  • 4