Install NFS Client

    Note

    Ubuntu 16.04 is used as an example in this tutorial.

    You must have an NFS server ready providing external storage services. Make sure you have created and exported a directory on the NFS server which your permitted client machines can access. For more information, see Set up an NFS Server.

    Install on all of the clients. It provides necessary NFS functions while you do not need to install any server components.

    1. Execute the following command to make sure you are using the latest package.

    2. Install nfs-common on all the clients.

      1. sudo apt-get install nfs-common
    3. Go to one of the client machines (taskbox) where you want to download KubeKey later. Create a configuration file that contains all the necessary parameters of your NFS server which will be referenced by KubeKey during installation.

      1. vi nfs-client.yaml

      An example configuration file:

      1. nfs:
      2. server: "192.168.0.2" # This is the server IP address. Replace it with your own.
      3. path: "/mnt/demo" # Replace the exported directory with your own.
      4. storageClass:
      5. defaultClass: false

      Note

      • If you want to configure more values, see .
      • The storageClass.defaultClass field controls whether you want to set the storage class of NFS-client Provisioner as the default one. If you input false for it, KubeKey will install OpenEBS to provide local volumes, while they are not provisioned dynamically as you create workloads on your cluster. After you install KubeSphere, you can change the default storage class on the console directly.
    4. Save the file.

    Follow the steps below to download on the taskbox.

    Download KubeKey from its GitHub Release Page or use the following command directly.

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

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

    1. export KKZONE=cn

    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.1.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.20.4 --with-kubesphere v3.1.0

      Note

      • Recommended Kubernetes versions for KubeSphere v3.1.0: 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 .

      • 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 the addons 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.

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

      1. vi config-sample.yaml
      1. ...
      2. metadata:
      3. name: sample
      4. spec:
      5. - {name: client1, address: 192.168.0.3, internalAddress: 192.168.0.3, user: ubuntu, password: Testing123}
      6. - {name: client2, address: 192.168.0.4, internalAddress: 192.168.0.4, user: ubuntu, password: Testing123}
      7. - {name: client3, address: 192.168.0.5, internalAddress: 192.168.0.5, user: ubuntu, password: Testing123}
      8. roleGroups:
      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.20.4
      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: nfs-client
      32. namespace: kube-system
      33. sources:
      34. chart:
      35. name: nfs-client-provisioner
      36. repo: https://charts.kubesphere.io/main
      37. valuesFile: /home/ubuntu/nfs-client.yaml # Use the path of your own NFS-client configuration file.
    3. Pay special attention to the field of addons, under which you must provide the information of NFS-client. For more information about each parameter in this file, see Multi-node Installation.

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

    5. Expected output:

      1. #####################################################
      2. ### Welcome to KubeSphere! ###
      3. #####################################################
      4. Console: http://192.168.0.3: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. #####################################################

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

    1. Run the following command to check your storage class.

      1. kubectl get sc

      Expected output:

      1. NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
      2. local (default) openebs.io/local Delete WaitForFirstConsumer false 16m
      3. nfs-client cluster.local/nfs-client-nfs-client-provisioner Delete Immediate true 16m

      Note

      If you set nfs-client as the default storage class, OpenEBS will not be installed by KubeKey.

    2. Run the following command to check the statuses of Pods.

      1. kubectl get pod -n kube-system

      Note that nfs-client is installed in the namespace kube-system. Expected output (exclude irrelevant Pods):

      1. NAME READY STATUS RESTARTS AGE
      2. nfs-client-nfs-client-provisioner-6fc95f4f79-92lsh 1/1 Running 0 16m

    KubeSphere console

    1. Log in to the web console as admin with the default account and password at <NodeIP>:30880. Click Platform in the top left corner and select Cluster Management.

    2. Go to Pods in Application Workloads and select from the project drop-down list. You can see that the Pod of nfs-client is up and running.