Installing Kubernetes with Kubespray

    Kubespray is a composition of Ansible playbooks, , provisioning tools, and domain knowledge for generic OS/Kubernetes clusters configuration management tasks.

    Kubespray provides:

    • Highly available cluster.
    • Composable (Choice of the network plugin for instance).
    • Supports most popular Linux distributions:
      • Flatcar Container Linux by Kinvolk
      • Debian Bullseye, Buster, Jessie, Stretch
      • CentOS/RHEL 7, 8, 9
      • Fedora 35, 36
      • Fedora CoreOS
      • openSUSE Leap 15.x/Tumbleweed
      • Oracle Linux 7, 8, 9
      • Alma Linux 8, 9
      • Rocky Linux 8, 9
      • Kylin Linux Advanced Server V10
      • Amazon Linux 2
    • Continuous integration tests.

    To choose a tool which best fits your use case, read this comparison to and kops.

    Provision servers with the following :

    • Minimum required version of Kubernetes is v1.22
    • Ansible v2.11+, Jinja 2.11+ and python-netaddr is installed on the machine that will run Ansible commands
    • The target servers must have access to the Internet in order to pull docker images. Otherwise, additional configuration is required See (Offline Environment)
    • The target servers are configured to allow IPv4 forwarding.
    • If using IPv6 for pods and services, the target servers are configured to allow IPv6 forwarding.
    • The firewalls are not managed, you’ll need to implement your own rules the way you used to. in order to avoid any issue during deployment you should disable your firewall.
    • If kubespray is run from non-root user account, correct privilege escalation method should be configured in the target servers. Then the flag or command parameters or should be specified.

    Kubespray provides the following utilities to help provision your environment:

    (2/5) Compose an inventory file

    Kubespray provides the ability to customize many aspects of the deployment:

    • Choice deployment mode: kubeadm or non-kubeadm
    • CNI (networking) plugins
    • DNS configuration
    • Choice of control plane: native/binary or containerized
    • Component versions
    • Calico route reflectors
    • Component runtime options
    • Certificate generation methods

    Kubespray customizations can be made to a variable file. If you are getting started with Kubespray, consider using the Kubespray defaults to deploy your cluster and explore Kubernetes.

    (4/5) Deploy a Cluster

    Next, deploy your cluster:

    Cluster deployment using ansible-playbook.

    Large deployments (100+ nodes) may require for best results.

    Kubespray provides additional playbooks to manage your cluster: scale and upgrade.

    Scale your cluster

    You can add worker nodes from your cluster by running the scale playbook. For more information, see ““. You can remove worker nodes from your cluster by running the remove-node playbook. For more information, see “Remove nodes“.

    You can upgrade your cluster by running the upgrade-cluster playbook. For more information, see “Upgrades“.

    You can reset your nodes and wipe out all components installed with Kubespray via the reset playbook.

    Caution: When running the reset playbook, be sure not to accidentally target your production cluster!

    • Check out planned work on Kubespray’s roadmap.