Rate This Document
Findability
Accuracy
Completeness
Readability

Multi-Node Deployment

The multi-node mode means that KubeSphere is deployed on multiple nodes, which is the most common deployment mode. A multi-node cluster consists of at least one master node and one worker node.

  1. Install dependencies on all nodes.
    yum install -y curl socat conntrack openssl ipset ipvsadm
  2. Download the installation tool KubeKey.
  3. Pre-download the container image package.

    The defaultbackend container image pulled by default does not support the Arm architecture. To ensure that the container can run properly on the Arm architecture, pull the container image package that supports the Arm architecture to the local host and replace the default image tag for it. The operation is as follows:

    docker pull mirrorgooglecontainers/defaultbackend-arm64:1.4
    docker tag mirrorgooglecontainers/defaultbackend-arm64:1.4 mirrorgooglecontainers/defaultbackend-amd64:1.4
    • In other scenarios, if the pulled image does not support the Arm architecture, you can refer to this step to pull the container image package that supports the Arm architecture to the local host and replace its image tag with the default image tag. This operation can solve the image compatibility problem.
      Run the following command to modify the container image tag:
      docker tag SOURCE_IMAGE:TAG1 TARGET_IMAGE:TAG2

      SOURCE_IMAGE:TAG1 indicates the tag before modification, and TARGET_IMAGE:TAG2 indicates the tag after modification.

    • If you cannot pull images from dockerhub.io, you are advised to configure the Docker image accelerator in advance and use other image sources to download the required Docker images. For details about how to change the image source, see Changing the Image Source.
  4. Use KubeKey to create a configuration file.

    Kubernetes v1.23.10 and KubeSphere v3.4.1 are used as examples:

    cd /home 
    ./kk create config --with-kubernetes v1.23.10 --with-kubesphere v3.4.1
    • The default name of the generated configuration file is config-sample.yaml.
    • The --with-kubernetes version parameter specifies the Kubernetes version to be installed. (For details about the supported Kubernetes versions, see https://github.com/kubesphere/kubekey/blob/master/README.md.) If --with-kubernetes is not added or version is not specified, v1.23.10 is installed by default.
    • The --with-kubesphere version parameter specifies the KubeSphere version to be installed. If --with-kubesphere is not added, KubeSphere is not installed. If version is not specified, the latest KubeSphere is installed by default.
  5. Modify the configuration file.
    1. Open the configuration file.
      vi config-sample.yaml
    2. Press i to enter the insert mode and add node information to the configuration file. Three nodes are used in this example, and the master node acts as the task machine:

      Host IP Address

      Host Name

      Role

      192.168.1.102

      master

      control plane, etcd

      192.168.1.100

      node1

      worker

      192.168.1.103

      node2

      worker

      Modify the content under the spec field as follows:

      spec:
        hosts:
        - {name: master, address: 192.168.1.102, internalAddress: 192.168.1.102, user: root, password: "kubesphere123", arch: arm64}
        - {name: node1, address: 192.168.1.100, internalAddress: 192.168.1.100, user: root, password: "kubesphere123", arch: arm64}
        - {name: node2, address: 192.168.1.103, internalAddress: 192.168.1.103, user: root, password: "kubesphere123", arch: arm64}
        roleGroups:
          etcd:
          - master
          control-plane:
          - master
          worker:
          - node1
          - node2

      The following figure shows the modification result.

      Based on the preceding configurations, list the detailed information about all servers under hosts:

      • name: host name of the node. The host name cannot contain uppercase letters. Otherwise, the installation cannot be completed.
      • address: IP address used for SSH connections between the current node and other nodes. Set this parameter based on actual requirements. The value can be a public or private IP address.
      • internalAddress: private IP address of the node.
      • user: user name.
      • password: password. Note that the password cannot contain the sign #.
      • arch: hardware architecture.

      Assign nodes to each role under the roleGroups section:

      • etcd: etcd node.
      • control-plane: master node. Generally, the control plane is hosted to control and manage the system.
      • worker: worker node. It runs the actual application deployed on the worker node.

      Modify the content under the etcd field to the following content to enable etcd monitoring:

      monitoring: true

      The following figure shows the modification result.

    3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  6. Deploy a Kubernetes cluster.

    Run the following command on the management node to create a Kubernetes cluster:

    ./kk create cluster -f config-sample.yaml

    After the command in this step is executed, KubeKey checks the installation environment. The check result is displayed in a table and the prompt information "Continue this installation? [yes/no]:" is displayed. Check whether all dependency requirements are met, type yes, and press Enter.

    During the installation, related component packages are downloaded from the Internet.

    After the installation is complete, the IP address and port number of the web console are displayed in the command output. The default port number is 30880. Now, you can use the default user name admin and password P@88w0rd to access the KubeSphere web console through <NodeIP>:30880 (http://192.168.1.102:30880 is used in this example).