问题原文
原帖链接 · Golide · CC BY-SA 4.0
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
已采纳解答
原帖链接 · anarxz · CC BY-SA 4.0
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:
- Stop the k0s service.
sudo k0s stop
- Reset previous installation that was done without your customized config file:
sudo k0s reset
- Re-install k0s with your new config file and with
--enable-workerflag -> 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
- Start the k0s service:
sudo k0s start
- 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
