Install GlusterFS
GlusterFS is an in-tree storage plugin in Kubernetes. Hence, you only need to install the storage class.
This tutorial demonstrates how to use KubeKey to set up a KubeSphere cluster and configure GlusterFS to provide storage services.
Note
Prerequisites
You have set up your GlusterFS cluster and configured Heketi. For more information, see Set up a GlusterFS Server.
Step 1: Configure the Client Machine
You need to install the GlusterFS client package on all your client machines.
-
Install
software-properties-common
.apt-get install software-properties-common
-
Add the community GlusterFS PPA.
add-apt-repository ppa:gluster/glusterfs-7
-
Make sure you are using the latest package.
apt-get update
-
Install the GlusterFS client.
apt-get install glusterfs-server -y
-
Verify your GlusterFS version.
glusterfs -V
Step 2: Create a Configuration File for GlusterFS
The separate configuration file contains all parameters of GlusterFS storage which will be used by KubeKey during installation.
-
Go to one of the nodes (taskbox) where you want to download KubeKey later and run the following command to create a configuration file.
vi glusterfs-sc.yaml
An example configuration file (include a Heketi Secret):
apiVersion: v1 kind: Secret metadata: name: heketi-secret namespace: kube-system type: kubernetes.io/glusterfs data: key: "MTIzNDU2" # Replace it with your own key. Base64 coding. --- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: annotations: storageclass.beta.kubernetes.io/is-default-class: "true" storageclass.kubesphere.io/supported-access-modes: '["ReadWriteOnce","ReadOnlyMany","ReadWriteMany"]' name: glusterfs parameters: clusterid: "21240a91145aee4d801661689383dcd1" # Replace it with your own GlusterFS cluster ID. gidMax: "50000" gidMin: "40000" restauthenabled: "true" resturl: "http://192.168.0.2:8080" # The Gluster REST service/Heketi service url which provision gluster volumes on demand. Replace it with your own. restuser: admin secretName: heketi-secret secretNamespace: kube-system volumetype: "replicate:3" # Replace it with your own volume type. provisioner: kubernetes.io/glusterfs reclaimPolicy: Delete volumeBindingMode: Immediate allowVolumeExpansion: true
Note
- Use the field
storageclass.beta.kubernetes.io/is-default-class
to setglusterfs
as your default storage class. If it isfalse
, KubeKey will install OpenEBS as the default storage class. - For more information about parameters in the storage class manifest, see the Kubernetes documentation.
- Use the field
-
Save the file.
Step 3: Download KubeKey
Follow the steps below to download KubeKey on the taskbox.
Download KubeKey from its GitHub Release Page or use the following command directly.
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -
Run the following command first to make sure you download KubeKey from the correct zone.
export KKZONE=cn
Run the following command to download KubeKey:
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -
Note
export KKZONE=cn
again before you proceed with the steps below.Note
Make kk
executable:
chmod +x kk
Step 4: Create a Cluster
-
Specify a Kubernetes version and a KubeSphere version that you want to install. For example:
./kk create config --with-kubernetes v1.20.4 --with-kubesphere v3.1.1
Note
-
Recommended Kubernetes versions for KubeSphere v3.1.1: v1.17.9, v1.18.8, v1.19.8, and v1.20.4. If you do not specify a Kubernetes version, KubeKey will install Kubernetes v1.19.8 by default. For more information about supported Kubernetes versions, see Support Matrix.
-
If you do not add the flag
--with-kubesphere
in the command in this step, KubeSphere will not be deployed unless you install it using theaddons
field in the configuration file or add this flag again when you use./kk create cluster
later. -
If you add the flag
--with-kubesphere
without specifying a KubeSphere version, the latest version of KubeSphere will be installed.
-
-
A default file
config-sample.yaml
will be created if you do not customize the name. Edit the file.vi config-sample.yaml
... metadata: name: sample spec: hosts: - {name: client1, address: 192.168.0.5, internalAddress: 192.168.0.5, user: ubuntu, password: Testing123} - {name: client2, address: 192.168.0.6, internalAddress: 192.168.0.6, user: ubuntu, password: Testing123} - {name: client3, address: 192.168.0.7, internalAddress: 192.168.0.7, user: ubuntu, password: Testing123} roleGroups: etcd: - client1 master: - client1 worker: - client2 - client3 controlPlaneEndpoint: domain: lb.kubesphere.local address: "" port: "6443" kubernetes: version: v1.20.4 imageRepo: kubesphere clusterName: cluster.local network: plugin: calico kubePodsCIDR: 10.233.64.0/18 kubeServiceCIDR: 10.233.0.0/18 registry: registryMirrors: [] insecureRegistries: [] addons: - name: glusterfs namespace: kube-system sources: yaml: path: - /root/glusterfs-sc.yaml ...
-
Pay special attention to the field of
addons
, under which you must provide the information of the storage class to be created as well as the Heketi Secret. For more information about each parameter in this file, see Multi-node Installation. -
Save the file and execute the following command to install Kubernetes and KubeSphere:
./kk create cluster -f config-sample.yaml
-
When the installation finishes, you can inspect installation logs with the following command:
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
Expected output:
##################################################### ### Welcome to KubeSphere! ### ##################################################### Console: http://192.168.0.4:30880 Account: admin Password: P@88w0rd NOTES: 1. After you log into the console, please check the monitoring status of service components in "Cluster Management". If any service is not ready, please wait patiently until all components are up and running. 2. Please change the default password after login. ##################################################### https://kubesphere.io 20xx-xx-xx xx:xx:xx #####################################################
Step 5: Verify Installation
You can verify that GlusterFS has been successfully installed either from the command line or from the KubeSphere web console.
Command line
Run the following command to check your storage class.
kubectl get sc
Expected output:
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
glusterfs (default) kubernetes.io/glusterfs Delete Immediate true 104m
KubeSphere console
-
Log in to the web console with the default account and password (
admin/P@88w0rd
) at<NodeIP>:30880
. Click Platform in the top-left corner and select Cluster Management. -
Go to Volumes under Storage, and you can see PVCs in use.
Note
For more information about how to create volumes on the KubeSphere console, see Volumes. -
On the Storage Classes page, you can see the storage class available in your cluster.
Feedback
Was this page Helpful?
Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.