You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

223 lines
12 KiB

  1. # Deploy a Production Ready Kubernetes Cluster
  2. ![Kubernetes Logo](https://raw.githubusercontent.com/kubernetes-sigs/kubespray/master/docs/img/kubernetes-logo.png)
  3. If you have questions, check the documentation at [kubespray.io](https://kubespray.io) and join us on the [kubernetes slack](https://kubernetes.slack.com), channel **\#kubespray**.
  4. You can get your invite [here](http://slack.k8s.io/)
  5. - Can be deployed on **[AWS](docs/cloud_providers/aws.md), GCE, [Azure](docs/cloud_providers/azure.md), [OpenStack](docs/cloud_controllers/openstack.md), [vSphere](docs/cloud_controllers/vsphere.md), [Equinix Metal](docs/cloud_providers/equinix-metal.md) (bare metal), Oracle Cloud Infrastructure (Experimental), or Baremetal**
  6. - **Highly available** cluster
  7. - **Composable** (Choice of the network plugin for instance)
  8. - Supports most popular **Linux distributions**
  9. - **Continuous integration tests**
  10. ## Quick Start
  11. Below are several ways to use Kubespray to deploy a Kubernetes cluster.
  12. ### Ansible
  13. #### Usage
  14. See [Getting started](/docs/getting_started/getting-started.md)
  15. #### Collection
  16. See [here](docs/ansible/ansible_collection.md) if you wish to use this repository as an Ansible collection
  17. ### Vagrant
  18. For Vagrant we need to install Python dependencies for provisioning tasks.
  19. Check that ``Python`` and ``pip`` are installed:
  20. ```ShellSession
  21. python -V && pip -V
  22. ```
  23. If this returns the version of the software, you're good to go. If not, download and install Python from here <https://www.python.org/downloads/source/>
  24. Install Ansible according to [Ansible installation guide](/docs/ansible/ansible.md#installing-ansible)
  25. then run the following step:
  26. ```ShellSession
  27. vagrant up
  28. ```
  29. ## Documents
  30. - [Requirements](#requirements)
  31. - [Kubespray vs ...](docs/getting_started/comparisons.md)
  32. - [Getting started](docs/getting_started/getting-started.md)
  33. - [Setting up your first cluster](docs/getting_started/setting-up-your-first-cluster.md)
  34. - [Ansible inventory and tags](docs/ansible/ansible.md)
  35. - [Integration with existing ansible repo](docs/operations/integration.md)
  36. - [Deployment data variables](docs/ansible/vars.md)
  37. - [DNS stack](docs/advanced/dns-stack.md)
  38. - [HA mode](docs/operations/ha-mode.md)
  39. - [Network plugins](#network-plugins)
  40. - [Vagrant install](docs/developers/vagrant.md)
  41. - [Flatcar Container Linux bootstrap](docs/operating_systems/flatcar.md)
  42. - [Fedora CoreOS bootstrap](docs/operating_systems/fcos.md)
  43. - [openSUSE setup](docs/operating_systems/opensuse.md)
  44. - [Downloaded artifacts](docs/advanced/downloads.md)
  45. - [Equinix Metal](docs/cloud_providers/equinix-metal.md)
  46. - [OpenStack](docs/cloud_controllers/openstack.md)
  47. - [vSphere](docs/cloud_controllers/vsphere.md)
  48. - [Large deployments](docs/operations/large-deployments.md)
  49. - [Adding/replacing a node](docs/operations/nodes.md)
  50. - [Upgrades basics](docs/operations/upgrades.md)
  51. - [Air-Gap installation](docs/operations/offline-environment.md)
  52. - [NTP](docs/advanced/ntp.md)
  53. - [Hardening](docs/operations/hardening.md)
  54. - [Mirror](docs/operations/mirror.md)
  55. - [Roadmap](docs/roadmap/roadmap.md)
  56. ## Supported Linux Distributions
  57. - **Flatcar Container Linux by Kinvolk**
  58. - **Debian** Bookworm, Bullseye
  59. - **Ubuntu** 20.04, 22.04, 24.04
  60. - **CentOS/RHEL** [8, 9](docs/operating_systems/rhel.md#rhel-8)
  61. - **Fedora** 39, 40
  62. - **Fedora CoreOS** (see [fcos Note](docs/operating_systems/fcos.md))
  63. - **openSUSE** Leap 15.x/Tumbleweed
  64. - **Oracle Linux** [8, 9](docs/operating_systems/rhel.md#rhel-8)
  65. - **Alma Linux** [8, 9](docs/operating_systems/rhel.md#rhel-8)
  66. - **Rocky Linux** [8, 9](docs/operating_systems/rhel.md#rhel-8)
  67. - **Kylin Linux Advanced Server V10** (experimental: see [kylin linux notes](docs/operating_systems/kylinlinux.md))
  68. - **Amazon Linux 2** (experimental: see [amazon linux notes](docs/operating_systems/amazonlinux.md))
  69. - **UOS Linux** (experimental: see [uos linux notes](docs/operating_systems/uoslinux.md))
  70. - **openEuler** (experimental: see [openEuler notes](docs/operating_systems/openeuler.md))
  71. Note:
  72. - Upstart/SysV init based OS types are not supported.
  73. - [Kernel requirements](docs/operations/kernel-requirements.md) (please read if the OS kernel version is < 4.19).
  74. ## Supported Components
  75. <!-- BEGIN ANSIBLE MANAGED BLOCK -->
  76. - Core
  77. - [kubernetes](https://github.com/kubernetes/kubernetes) v1.32.0
  78. - [etcd](https://github.com/etcd-io/etcd) v3.5.16
  79. - [docker](https://www.docker.com/) v26.1
  80. - [containerd](https://containerd.io/) v1.7.24
  81. - [cri-o](http://cri-o.io/) v1.32.0 (experimental: see [CRI-O Note](docs/CRI/cri-o.md). Only on fedora, ubuntu and centos based OS)
  82. - Network Plugin
  83. - [cni-plugins](https://github.com/containernetworking/plugins) v1.4.0
  84. - [calico](https://github.com/projectcalico/calico) v3.29.1
  85. - [cilium](https://github.com/cilium/cilium) v1.15.9
  86. - [flannel](https://github.com/flannel-io/flannel) v0.22.0
  87. - [kube-ovn](https://github.com/alauda/kube-ovn) v1.12.21
  88. - [kube-router](https://github.com/cloudnativelabs/kube-router) v2.0.0
  89. - [multus](https://github.com/k8snetworkplumbingwg/multus-cni) v4.1.0
  90. - [weave](https://github.com/rajch/weave) v2.8.7
  91. - [kube-vip](https://github.com/kube-vip/kube-vip) v0.8.0
  92. - Application
  93. - [cert-manager](https://github.com/jetstack/cert-manager) v1.15.3
  94. - [coredns](https://github.com/coredns/coredns) v1.11.3
  95. - [ingress-nginx](https://github.com/kubernetes/ingress-nginx) v1.12.0
  96. - [krew](https://github.com/kubernetes-sigs/krew) v0.4.4
  97. - [argocd](https://argoproj.github.io/) v2.11.0
  98. - [helm](https://helm.sh/) v3.16.4
  99. - [metallb](https://metallb.universe.tf/) v0.13.9
  100. - [registry](https://github.com/distribution/distribution) v2.8.1
  101. - Storage Plugin
  102. - [cephfs-provisioner](https://github.com/kubernetes-incubator/external-storage) v2.1.0-k8s1.11
  103. - [rbd-provisioner](https://github.com/kubernetes-incubator/external-storage) v2.1.1-k8s1.11
  104. - [aws-ebs-csi-plugin](https://github.com/kubernetes-sigs/aws-ebs-csi-driver) v0.5.0
  105. - [azure-csi-plugin](https://github.com/kubernetes-sigs/azuredisk-csi-driver) v1.10.0
  106. - [cinder-csi-plugin](https://github.com/kubernetes/cloud-provider-openstack/blob/master/docs/cinder-csi-plugin/using-cinder-csi-plugin.md) v1.30.0
  107. - [gcp-pd-csi-plugin](https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver) v1.9.2
  108. - [local-path-provisioner](https://github.com/rancher/local-path-provisioner) v0.0.24
  109. - [local-volume-provisioner](https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner) v2.5.0
  110. - [node-feature-discovery](https://github.com/kubernetes-sigs/node-feature-discovery) v0.16.4
  111. <!-- END ANSIBLE MANAGED BLOCK -->
  112. ## Container Runtime Notes
  113. - The cri-o version should be aligned with the respective kubernetes version (i.e. kube_version=1.20.x, crio_version=1.20)
  114. ## Requirements
  115. - **Minimum required version of Kubernetes is v1.30**
  116. - **Ansible v2.14+, Jinja 2.11+ and python-netaddr is installed on the machine that will run Ansible commands**
  117. - The target servers must have **access to the Internet** in order to pull docker images. Otherwise, additional configuration is required (See [Offline Environment](docs/operations/offline-environment.md))
  118. - The target servers are configured to allow **IPv4 forwarding**.
  119. - If using IPv6 for pods and services, the target servers are configured to allow **IPv6 forwarding**.
  120. - The **firewalls are not managed**, you'll need to implement your own rules the way you used to.
  121. in order to avoid any issue during deployment you should disable your firewall.
  122. - If kubespray is run from non-root user account, correct privilege escalation method
  123. should be configured in the target servers. Then the `ansible_become` flag
  124. or command parameters `--become or -b` should be specified.
  125. Hardware:
  126. These limits are safeguarded by Kubespray. Actual requirements for your workload can differ. For a sizing guide go to the [Building Large Clusters](https://kubernetes.io/docs/setup/cluster-large/#size-of-master-and-master-components) guide.
  127. - Control Plane
  128. - Memory: 2 GB
  129. - Worker Node
  130. - Memory: 1 GB
  131. ## Network Plugins
  132. You can choose among ten network plugins. (default: `calico`, except Vagrant uses `flannel`)
  133. - [flannel](docs/CNI/flannel.md): gre/vxlan (layer 2) networking.
  134. - [Calico](https://docs.tigera.io/calico/latest/about/) is a networking and network policy provider. Calico supports a flexible set of networking options
  135. designed to give you the most efficient networking across a range of situations, including non-overlay
  136. and overlay networks, with or without BGP. Calico uses the same engine to enforce network policy for hosts,
  137. pods, and (if using Istio and Envoy) applications at the service mesh layer.
  138. - [cilium](http://docs.cilium.io/en/latest/): layer 3/4 networking (as well as layer 7 to protect and secure application protocols), supports dynamic insertion of BPF bytecode into the Linux kernel to implement security services, networking and visibility logic.
  139. - [weave](docs/CNI/weave.md): Weave is a lightweight container overlay network that doesn't require an external K/V database cluster.
  140. (Please refer to `weave` [troubleshooting documentation](https://www.weave.works/docs/net/latest/troubleshooting/)).
  141. - [kube-ovn](docs/CNI/kube-ovn.md): Kube-OVN integrates the OVN-based Network Virtualization with Kubernetes. It offers an advanced Container Network Fabric for Enterprises.
  142. - [kube-router](docs/CNI/kube-router.md): Kube-router is a L3 CNI for Kubernetes networking aiming to provide operational
  143. simplicity and high performance: it uses IPVS to provide Kube Services Proxy (if setup to replace kube-proxy),
  144. iptables for network policies, and BGP for ods L3 networking (with optionally BGP peering with out-of-cluster BGP peers).
  145. It can also optionally advertise routes to Kubernetes cluster Pods CIDRs, ClusterIPs, ExternalIPs and LoadBalancerIPs.
  146. - [macvlan](docs/CNI/macvlan.md): Macvlan is a Linux network driver. Pods have their own unique Mac and Ip address, connected directly the physical (layer 2) network.
  147. - [multus](docs/CNI/multus.md): Multus is a meta CNI plugin that provides multiple network interface support to pods. For each interface Multus delegates CNI calls to secondary CNI plugins such as Calico, macvlan, etc.
  148. - [custom_cni](roles/network-plugin/custom_cni/) : You can specify some manifests that will be applied to the clusters to bring you own CNI and use non-supported ones by Kubespray.
  149. See `tests/files/custom_cni/README.md` and `tests/files/custom_cni/values.yaml`for an example with a CNI provided by a Helm Chart.
  150. The network plugin to use is defined by the variable `kube_network_plugin`. There is also an
  151. option to leverage built-in cloud provider networking instead.
  152. See also [Network checker](docs/advanced/netcheck.md).
  153. ## Ingress Plugins
  154. - [nginx](https://kubernetes.github.io/ingress-nginx): the NGINX Ingress Controller.
  155. - [metallb](docs/ingress/metallb.md): the MetalLB bare-metal service LoadBalancer provider.
  156. ## Community docs and resources
  157. - [kubernetes.io/docs/setup/production-environment/tools/kubespray/](https://kubernetes.io/docs/setup/production-environment/tools/kubespray/)
  158. - [kubespray, monitoring and logging](https://github.com/gregbkr/kubernetes-kargo-logging-monitoring) by @gregbkr
  159. - [Deploy Kubernetes w/ Ansible & Terraform](https://rsmitty.github.io/Terraform-Ansible-Kubernetes/) by @rsmitty
  160. - [Deploy a Kubernetes Cluster with Kubespray (video)](https://www.youtube.com/watch?v=CJ5G4GpqDy0)
  161. ## Tools and projects on top of Kubespray
  162. - [Digital Rebar Provision](https://github.com/digitalrebar/provision/blob/v4/doc/integrations/ansible.rst)
  163. - [Terraform Contrib](https://github.com/kubernetes-sigs/kubespray/tree/master/contrib/terraform)
  164. - [Kubean](https://github.com/kubean-io/kubean)
  165. ## CI Tests
  166. [![Build graphs](https://gitlab.com/kargo-ci/kubernetes-sigs-kubespray/badges/master/pipeline.svg)](https://gitlab.com/kargo-ci/kubernetes-sigs-kubespray/-/pipelines)
  167. CI/end-to-end tests sponsored by: [CNCF](https://cncf.io), [Equinix Metal](https://metal.equinix.com/), [OVHcloud](https://www.ovhcloud.com/), [ELASTX](https://elastx.se/).
  168. See the [test matrix](docs/developers/test_cases.md) for details.