mirror of
https://github.com/geerlingguy/ansible-role-kubernetes.git
synced 2025-04-30 01:20:51 +02:00
Cilium (#1)
* Add ability to use Cilium CNI --------- Co-authored-by: Michael McCulloch <mjm.gitlab@fastmail.com>
This commit is contained in:
parent
25e782117c
commit
fee7a74c79
@ -11,6 +11,7 @@ kubernetes_packages:
|
|||||||
|
|
||||||
kubernetes_version: '1.25'
|
kubernetes_version: '1.25'
|
||||||
kubernetes_version_rhel_package: '1.25.1'
|
kubernetes_version_rhel_package: '1.25.1'
|
||||||
|
kubernetes_cilium_version: '1.14.5' # Set the default version of Cilium to install
|
||||||
|
|
||||||
kubernetes_role: control_plane
|
kubernetes_role: control_plane
|
||||||
|
|
||||||
@ -70,3 +71,5 @@ kubernetes_flannel_manifest_file: https://raw.githubusercontent.com/flannel-io/f
|
|||||||
|
|
||||||
# Calico config file.
|
# Calico config file.
|
||||||
kubernetes_calico_manifest_file: https://projectcalico.docs.tigera.io/manifests/calico.yaml
|
kubernetes_calico_manifest_file: https://projectcalico.docs.tigera.io/manifests/calico.yaml
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,6 +45,68 @@
|
|||||||
state: link
|
state: link
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Taint nodes with cilium agent-not-ready
|
||||||
|
command: kubectl taint nodes --all node.cilium.io/agent-not-ready=true:NoExecute
|
||||||
|
when:
|
||||||
|
- kubernetes_pod_network.cni == 'cilium'
|
||||||
|
- not kubernetes_init_stat.stat.exists
|
||||||
|
|
||||||
|
- name: Check if Cilium CLI has already been Installed.
|
||||||
|
stat:
|
||||||
|
path: /usr/local/bin/cilium
|
||||||
|
register: cilium_init_stat
|
||||||
|
|
||||||
|
- name: Install Cilium CLI
|
||||||
|
when:
|
||||||
|
- kubernetes_pod_network.cni == 'cilium'
|
||||||
|
- not cilium_init_stat.stat.exists
|
||||||
|
block:
|
||||||
|
- name: Get Cilium CLI version
|
||||||
|
shell: curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt
|
||||||
|
register: cilium_cli_version
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Set CLI architecture
|
||||||
|
set_fact:
|
||||||
|
cli_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
|
||||||
|
|
||||||
|
- name: Download Cilium CLI
|
||||||
|
get_url:
|
||||||
|
url: "https://github.com/cilium/cilium-cli/releases/download/{{ cilium_cli_version.stdout }}/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||||
|
dest: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Download Cilium CLI checksum
|
||||||
|
get_url:
|
||||||
|
url: "https://github.com/cilium/cilium-cli/releases/download/{{ cilium_cli_version.stdout }}/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum"
|
||||||
|
dest: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Verify Cilium CLI checksum
|
||||||
|
shell: sha256sum --check /tmp/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum
|
||||||
|
args:
|
||||||
|
chdir: /tmp
|
||||||
|
|
||||||
|
- name: Extract Cilium CLI
|
||||||
|
unarchive:
|
||||||
|
src: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||||
|
dest: /usr/local/bin
|
||||||
|
remote_src: yes
|
||||||
|
|
||||||
|
- name: Remove downloaded files
|
||||||
|
file:
|
||||||
|
path: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz{{ item }}"
|
||||||
|
state: absent
|
||||||
|
loop:
|
||||||
|
- ''
|
||||||
|
- '.sha256sum'
|
||||||
|
|
||||||
|
- name: Configure Cilium networking
|
||||||
|
command: /usr/local/bin/cilium install --version {{ kubernetes_cilium_version }}
|
||||||
|
when:
|
||||||
|
- kubernetes_pod_network.cni == 'cilium'
|
||||||
|
- not kubernetes_init_stat.stat.exists
|
||||||
|
|
||||||
- name: Configure Flannel networking.
|
- name: Configure Flannel networking.
|
||||||
command: "kubectl apply -f {{ kubernetes_flannel_manifest_file }}"
|
command: "kubectl apply -f {{ kubernetes_flannel_manifest_file }}"
|
||||||
register: flannel_result
|
register: flannel_result
|
||||||
@ -87,3 +149,5 @@
|
|||||||
when:
|
when:
|
||||||
- kubernetes_allow_pods_on_control_plane | bool
|
- kubernetes_allow_pods_on_control_plane | bool
|
||||||
- not kubernetes_init_stat.stat.exists
|
- not kubernetes_init_stat.stat.exists
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user