Install GlusterFS

    This tutorial demonstrates how to use KubeKey to set up a KubeSphere cluster and configure GlusterFS to provide storage services.

    Note

    Ubuntu 16.04 is used as an example in this tutorial.

    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.

    1. Install .

    2. Add the community GlusterFS PPA.

      1. add-apt-repository ppa:gluster/glusterfs-7
    3. Make sure you are using the latest package.

      1. apt-get update
    4. Install the GlusterFS client.

      1. apt-get install glusterfs-server -y
    5. Verify your GlusterFS version.

      1. glusterfs -V

    The separate configuration file contains all parameters of GlusterFS storage which will be used by KubeKey during installation.

    1. Go to one of the nodes (taskbox) where you want to download KubeKey later and run the following command to create a configuration file.

      1. vi glusterfs-sc.yaml

      An example configuration file (include a Heketi Secret):

      • Use the field storageclass.beta.kubernetes.io/is-default-class to set glusterfs as your default storage class. If it is false, KubeKey will install OpenEBS as the default storage class.
      • For more information about parameters in the storage class manifest, see the Kubernetes documentation.
    2. Save the file.

    Step 3: Download KubeKey

    Follow the steps below to download KubeKey on the taskbox.

    Download KubeKey from its or use the following command directly.

    1. curl -sfL https://get-kk.kubesphere.io | VERSION=v1.2.0 sh -

    Run the following command first to make sure you download KubeKey from the correct zone.

    1. export KKZONE=cn

    Run the following command to download KubeKey:

    1. curl -sfL https://get-kk.kubesphere.io | VERSION=v1.2.0 sh -

    Note

    After you download KubeKey, if you transfer it to a new machine also with poor network connections to Googleapis, you must run export KKZONE=cn again before you proceed with the steps below.

    Note

    The commands above download the latest release (v1.2.0) of KubeKey. You can change the version number in the command to download a specific version.

    Make kk executable:

    1. chmod +x kk
    1. Specify a Kubernetes version and a KubeSphere version that you want to install. For example:

      1. ./kk create config --with-kubernetes v1.21.5 --with-kubesphere v3.2.0

      Note

      • Recommended Kubernetes versions for KubeSphere 3.2.0: v1.19.x, v1.20.x, v1.21.x or v1.22.x (experimental). If you do not specify a Kubernetes version, KubeKey will install Kubernetes v1.21.5 by default. For more information about supported Kubernetes versions, see Support Matrix.

      • If you add the flag --with-kubesphere without specifying a KubeSphere version, the latest version of KubeSphere will be installed.

    2. A default file config-sample.yaml will be created if you do not customize the name. Edit the file.

      1. metadata:
      2. name: sample
      3. spec:
      4. hosts:
      5. - {name: client1, address: 192.168.0.5, internalAddress: 192.168.0.5, user: ubuntu, password: Testing123}
      6. - {name: client2, address: 192.168.0.6, internalAddress: 192.168.0.6, user: ubuntu, password: Testing123}
      7. roleGroups:
      8. etcd:
      9. - client1
      10. master:
      11. - client1
      12. worker:
      13. - client2
      14. - client3
      15. controlPlaneEndpoint:
      16. domain: lb.kubesphere.local
      17. address: ""
      18. port: "6443"
      19. kubernetes:
      20. version: v1.21.5
      21. imageRepo: kubesphere
      22. clusterName: cluster.local
      23. network:
      24. plugin: calico
      25. kubePodsCIDR: 10.233.64.0/18
      26. kubeServiceCIDR: 10.233.0.0/18
      27. registry:
      28. registryMirrors: []
      29. insecureRegistries: []
      30. addons:
      31. - name: glusterfs
      32. sources:
      33. path:
      34. - /root/glusterfs-sc.yaml
      35. ...
    3. 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 .

    4. Save the file and execute the following command to install Kubernetes and KubeSphere:

      1. ./kk create cluster -f config-sample.yaml
    5. When the installation finishes, you can inspect installation logs with the following command:

      1. kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

      Expected output:

      1. #####################################################
      2. ### Welcome to KubeSphere! ###
      3. #####################################################
      4. Console: http://192.168.0.4:30880
      5. Account: admin
      6. Password: [email protected]
      7. NOTES
      8. 1. After you log into the console, please check the
      9. monitoring status of service components in
      10. "Cluster Management". If any service is not
      11. ready, please wait patiently until all components
      12. are up and running.
      13. 2. Please change the default password after login.
      14. #####################################################
      15. https://kubesphere.io 20xx-xx-xx xx:xx:xx
      16. #####################################################

    Step 5: Verify Installation

    You can verify that GlusterFS has been successfully installed either from the command line or from the KubeSphere web console.

    Run the following command to check your storage class.

    1. kubectl get sc

    Expected output:

    KubeSphere console

    1. Log in to the web console with the default account and password (admin/[[email protected]](https://kubesphere.io/cdn-cgi/l/email-protection)) at . Click Platform in the upper-left corner and select Cluster Management.

    2. 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.