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.

105 lines
5.4 KiB

  1. # Offline environment
  2. In case your servers don't have access to internet (for example when deploying on premises with security constraints), you need to setup:
  3. * a HTTP reverse proxy/cache/mirror to serve some static files (zips and binaries)
  4. * an internal Yum/Deb repository for OS packages
  5. * an internal container image registry that need to be populated with all container images used by Kubespray. Exhaustive list depends on your setup
  6. * [Optional] an internal PyPi server for kubespray python packages (only required if your OS doesn't provide all python packages/versions listed in `requirements.txt`)
  7. * [Optional] an internal Helm registry (only required if `helm_enabled=true`)
  8. ## Configure Inventory
  9. Once all artifacts are accessible from your internal network, **adjust** the following variables in your inventory to match your environment:
  10. ```yaml
  11. # Registry overrides
  12. gcr_image_repo: "{{ registry_host }}"
  13. docker_image_repo: "{{ registry_host }}"
  14. quay_image_repo: "{{ registry_host }}"
  15. kubeadm_download_url: "{{ files_repo }}/kubernetes/{{ kube_version }}/kubeadm"
  16. kubectl_download_url: "{{ files_repo }}/kubernetes/{{ kube_version }}/kubectl"
  17. kubelet_download_url: "{{ files_repo }}/kubernetes/{{ kube_version }}/kubelet"
  18. # etcd is optional if you **DON'T** use etcd_deployment=host
  19. etcd_download_url: "{{ files_repo }}/kubernetes/etcd/etcd-{{ etcd_version }}-linux-amd64.tar.gz"
  20. cni_download_url: "{{ files_repo }}/kubernetes/cni/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
  21. crictl_download_url: "{{ files_repo }}/kubernetes/cri-tools/crictl-{{ crictl_version }}-{{ ansible_system | lower }}-{{ image_arch }}.tar.gz"
  22. # If using Calico
  23. calicoctl_download_url: "{{ files_repo }}/kubernetes/calico/{{ calico_ctl_version }}/calicoctl-linux-{{ image_arch }}"
  24. # CentOS/Redhat
  25. ## Docker
  26. docker_rh_repo_base_url: "{{ yum_repo }}/docker-ce/$releasever/$basearch"
  27. docker_rh_repo_gpgkey: "{{ yum_repo }}/docker-ce/gpg"
  28. ## Containerd
  29. extras_rh_repo_base_url: "{{ yum_repo }}/centos/$releasever/extras/$basearch"
  30. extras_rh_repo_gpgkey: "{{ yum_repo }}/containerd/gpg"
  31. # Fedora
  32. ## Docker
  33. docker_fedora_repo_base_url: "{{ yum_repo }}/docker-ce/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}"
  34. docker_fedora_repo_gpgkey: "{{ yum_repo }}/docker-ce/gpg"
  35. ## Containerd
  36. containerd_fedora_repo_base_url: "{{ yum_repo }}/containerd"
  37. containerd_fedora_repo_gpgkey: "{{ yum_repo }}/docker-ce/gpg"
  38. # Debian
  39. ## Docker
  40. docker_debian_repo_base_url: "{{ debian_repo }}/docker-ce"
  41. docker_debian_repo_gpgkey: "{{ debian_repo }}/docker-ce/gpg"
  42. ## Containerd
  43. containerd_debian_repo_base_url: "{{ ubuntu_repo }}/containerd"
  44. containerd_debian_repo_gpgkey: "{{ ubuntu_repo }}/containerd/gpg"
  45. containerd_debian_repo_repokey: 'YOURREPOKEY'
  46. # Ubuntu
  47. ## Docker
  48. docker_ubuntu_repo_base_url: "{{ ubuntu_repo }}/docker-ce"
  49. docker_ubuntu_repo_gpgkey: "{{ ubuntu_repo }}/docker-ce/gpg"
  50. ## Containerd
  51. containerd_ubuntu_repo_base_url: "{{ ubuntu_repo }}/containerd"
  52. containerd_ubuntu_repo_gpgkey: "{{ ubuntu_repo }}/containerd/gpg"
  53. containerd_ubuntu_repo_repokey: 'YOURREPOKEY'
  54. # If using helm
  55. helm_stable_repo_url: "{{ helm_registry }}"
  56. ```
  57. For the OS specific settings, just define the one matching your OS.
  58. If you use the settings like the one above, you'll need to define in your inventory the following variables:
  59. * `registry_host`: Container image registry. If you _don't_ use the same repository path for the container images that the ones defined in [Download's role defaults](https://github.com/kubernetes-sigs/kubespray/blob/master/roles/download/defaults/main.yml), you need to override the `*_image_repo` for these container images. If you want to make your life easier, use the same repository path, you won't have to override anything else.
  60. * `files_repo`: HTTP webserver or reverse proxy that is able to serve the files listed above. Path is not important, you can store them anywhere as long as it's accessible by kubespray. It's recommended to use `*_version` in the path so that you don't need to modify this setting everytime kubespray upgrades one of these components.
  61. * `yum_repo`/`debian_repo`/`ubuntu_repo`: OS package repository depending of your OS, should point to your internal repository. Adjust the path accordingly.
  62. * `helm_registry`: Helm Registry to use for `stable` Helm Charts if `helm_enabled: true`
  63. ## Install Kubespray Python Packages
  64. Look at the `requirements.txt` file and check if your OS provides all packages out-of-the-box (Using the OS package manager). For those missing, you need to either use a proxy that has Internet access (typically from a DMZ) or setup a PyPi server in your network that will host these packages.
  65. If you're using a HTTP(S) proxy to download your python packages:
  66. ```bash
  67. sudo pip install --proxy=https://[username:password@]proxyserver:port -r requirements.txt
  68. ```
  69. When using an internal PyPi server:
  70. ```bash
  71. # If you host all required packages
  72. pip install -i https://pypiserver/pypi -r requirements.txt
  73. # If you only need the ones missing from the OS package manager
  74. pip install -i https://pypiserver/pypi package_you_miss
  75. ```
  76. ## Run Kubespray as usual
  77. Once all artifacts are in place and your inventory properly set up, you can run kubespray with the regular `cluster.yaml` command:
  78. ```bash
  79. ansible-playbook -i inventory/my_airgap_cluster/hosts.yaml -b cluster.yml
  80. ```
  81. ## Please Note: Offline installation doesn't support CRI-O container runtime at the moment (see [this issue](https://github.com/kubernetes-sigs/kubespray/issues/6233))