Score:1

How do I configure storage class on an existing k0s cluster

cn flag

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
br flag
Could you please give more details on your issue to reproduce it - do you use k0s on any cloud or on bare metal?
cn flag
Bare metal server Debian 10
cn flag
Im following this guide https://techviewleo.com/deploy-kubernetes-cluster-on-debian-using-k0s/
cn flag
@anarxz Suggestion is to do sudo systemctl restart k0scontroller . I have run this command but still k0s kubectl get storageclass returns No resources found
Score:1
br flag

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.

cn flag
noted thanks , I was still in the middle of troubleshooting , let me work on that
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.