Deploy a Kubernetes cluster

Deploy a Kubernetes cluster

After you complete the prerequisite steps described in Prerequisites, deploy your MCP Kubernetes cluster manually using the procedure below.

To deploy the Kubernetes cluster:

  1. Log in to the Salt Master node.

  2. Update modules and states on all Minions:

    salt '*' saltutil.sync_all
    
  3. If you use autoregistration for the compute nodes, register all discovered compute nodes. Run the following command on every compute node:

    salt-call event.send "reclass/minion/classify" \
     "{\"node_master_ip\": \"<config_host>\", \
     \"node_os\": \"<os_codename>\", \
     \"node_deploy_ip\": \"<node_deploy_network_ip>\", \
     \"node_deploy_iface\": \"<node_deploy_network_iface>\", \
     \"node_control_ip\": \"<node_control_network_ip>\", \
     \"node_control_iface\": \"<node_control_network_iface>\", \
     \"node_sriov_ip\": \"<node_sriov_ip>\", \
     \"node_sriov_iface\": \"<node_sriov_iface>\", \
     \"node_tenant_ip\": \"<node_tenant_network_ip>\", \
     \"node_tenant_iface\": \"<node_tenant_network_iface>\", \
     \"node_external_ip\": \"<node_external_network_ip>\", \
     \"node_external_iface\": \"<node_external_network_iface>\", \
     \"node_baremetal_ip\": \"<node_baremetal_network_ip>\", \
     \"node_baremetal_iface\": \"<node_baremetal_network_iface>\", \
     \"node_domain\": \"<node_domain>\", \
     \"node_cluster\": \"<cluster_name>\", \
     \"node_hostname\": \"<node_hostname>\"}"
    

    Modify the parameters passed with the command above as required. The table below provides the description of the parameters required for a compute node registration.

    Parameter

    Description

    config_host

    IP of the Salt Master node

    os_codename

    Operating system code name. Check the system response of lsb_release -c for it

    node_deploy_network_ip

    Minion deploy network IP address

    node_deploy_network_iface

    Minion deploy network interface

    node_control_network_ip

    Minion control network IP address

    node_control_network_iface

    Minion control network interface

    node_sriov_ip

    Minion SR-IOV IP address

    node_sriov_iface

    Minion SR-IOV interface

    node_tenant_network_ip

    Minion tenant network IP address

    node_tenant_network_iface

    Minion tenant network interface

    node_external_network_ip

    Minion external network IP address

    node_external_network_iface

    Minion external network interface

    node_baremetal_network_ip

    Minion baremetal network IP address

    node_baremetal_network_iface

    Minion baremetal network interface

    node_domain

    Domain of a minion. Check the system response of hostname -d for it

    cluster_name

    Value of the cluster_name variable specified in the Reclass model. See Basic deployment parameters for details

    node_hostname

    Short hostname without a domain part. Check the system response of hostname -s for it

  4. Log in to the Salt Master node.

  5. Perform Linux system configuration to synchronize repositories and execute outstanding system maintenance tasks:

    salt '*' state.sls linux.system
    
  6. Install the Kubernetes control plane:

    1. Bootstrap the Kubernetes Master nodes:

      salt -C 'I@kubernetes:master' state.sls  linux
      salt -C 'I@kubernetes:master' state.sls  salt.minion
      salt -C 'I@kubernetes:master' state.sls openssh,ntp
      
    2. Create and distribute SSL certificates for services using the salt state and install etcd with the SSL support:

      salt -C 'I@kubernetes:master' state.sls salt.minion.cert,etcd.server.service
      salt -C 'I@etcd:server' cmd.run '. /var/lib/etcd/configenv && etcdctl cluster-health'
      
    3. Install Keepalived:

      salt -C 'I@keepalived:cluster' state.sls keepalived -b 1
      
    4. Install HAProxy:

      salt -C 'I@haproxy:proxy' state.sls haproxy
      salt -C 'I@haproxy:proxy' service.status haproxy
      
    5. Install Kubernetes:

      salt -C 'I@kubernetes:master' state.sls kubernetes.master.kube-addons
      salt -C 'I@kubernetes:master' state.sls kubernetes.pool
      
    6. For the Calico setup:

      1. Verify the Calico nodes status:

        salt -C 'I@kubernetes:pool' cmd.run "calicoctl node status"
        
      2. Set up NAT for Calico:

        salt -C 'I@kubernetes:master' state.sls etcd.server.setup
        
    7. Apply the following state to simplify namespaces creation:

      salt -C 'I@kubernetes:master and *01*' state.sls kubernetes.master \
      exclude=kubernetes.master.setup
      
    8. Apply the following state:

      salt -C 'I@kubernetes:master' state.sls kubernetes exclude=kubernetes.master.setup
      
    9. Run the Kubernetes Master nodes setup:

      salt -C 'I@kubernetes:master' state.sls kubernetes.master.setup
      
    10. Restart kubelet:

      salt -C 'I@kubernetes:master' service.restart kubelet
      
  7. Log in to any Kubernetes Master node and verify that all nodes have been registered successfully:

    kubectl get nodes
    
  8. Deploy the Kubernetes Nodes:

    1. Log in to the Salt Master node.

    2. Bootstrap all compute nodes:

      salt -C 'I@kubernetes:pool and not I@kubernetes:master' state.sls linux
      salt -C 'I@kubernetes:pool and not I@kubernetes:master' state.sls  salt.minion
      salt -C 'I@kubernetes:pool and not I@kubernetes:master' state.sls openssh,ntp
      
    3. Create and distribute SSL certificates for services and install etcd with the SSL support:

      salt -C 'I@kubernetes:pool and not I@kubernetes:master' state.sls salt.minion.cert,etcd.server.service
      salt -C 'I@etcd:server' cmd.run '. /var/lib/etcd/configenv && etcdctl cluster-health'
      
    4. Install Kubernetes:

      salt -C 'I@kubernetes:pool and not I@kubernetes:master' state.sls kubernetes.pool
      
    5. Restart kubelet:

      salt -C 'I@kubernetes:pool and not I@kubernetes:master' service.restart kubelet
      

After you deploy Kubernetes, deploy StackLight LMA to your cluster as described in Deploy StackLight LMA.