mirror of
				https://github.com/geerlingguy/ansible-role-kubernetes.git
				synced 2025-10-24 11:16:22 +02:00 
			
		
		
		
	Optionally include the hubble cli
This commit is contained in:
		
							parent
							
								
									6dfccdf971
								
							
						
					
					
						commit
						3b8e19045a
					
				| @ -13,6 +13,7 @@ kubernetes_version: '1.25' | ||||
| kubernetes_version_rhel_package: '1.25.1' | ||||
| kubernetes_cilium_version: '1.14.5' | ||||
| kubernetes_cilium_datapath: 'native' | ||||
| kubernetes_cilium_hubble_client: false | ||||
| kubernetes_cilium_values: "" | ||||
| 
 | ||||
| kubernetes_role: control_plane | ||||
|  | ||||
| @ -22,10 +22,10 @@ | ||||
|     --config {{ kubernetes_kubeadm_kubelet_config_file_path }} | ||||
|     {{ kubernetes_kubeadm_init_extra_opts }} | ||||
|   register: kubeadmin_init | ||||
|   when: > | ||||
|     (not kubernetes_init_stat.stat.exists) and | ||||
|     (kubernetes_ignore_preflight_errors is not defined) and | ||||
|     (not (replace_kube_proxy)) | ||||
|   when: | ||||
|     - not kubernetes_init_stat.stat.exists | ||||
|     - kubernetes_ignore_preflight_errors is not defined | ||||
|     - not replace_kube_proxy | ||||
| 
 | ||||
| - name: Initialize Kubernetes control plane with kubeadm init and ignore_preflight_errors | ||||
|   command: > | ||||
| @ -34,10 +34,10 @@ | ||||
|     --ignore-preflight-errors={{ kubernetes_ignore_preflight_errors }} | ||||
|     {{ kubernetes_kubeadm_init_extra_opts }} | ||||
|   register: kubeadmin_init | ||||
|   when: > | ||||
|     (not kubernetes_init_stat.stat.exists) and | ||||
|     (kubernetes_ignore_preflight_errors is defined) and | ||||
|     (not (replace_kube_proxy)) | ||||
|   when: | ||||
|     - not kubernetes_init_stat.stat.exists | ||||
|     - kubernetes_ignore_preflight_errors is defined | ||||
|     - not replace_kube_proxy | ||||
| 
 | ||||
| - name: Initialize Kubernetes control plane with kubeadm init without kube-proxy | ||||
|   command: > | ||||
| @ -46,10 +46,10 @@ | ||||
|     --skip-phases=addon/kube-proxy | ||||
|     {{ kubernetes_kubeadm_init_extra_opts }} | ||||
|   register: kubeadmin_init | ||||
|   when: > | ||||
|     (not kubernetes_init_stat.stat.exists) and | ||||
|     (kubernetes_ignore_preflight_errors is not defined) and | ||||
|     (replace_kube_proxy) | ||||
|   when: | ||||
|     - not kubernetes_init_stat.stat.exists | ||||
|     - kubernetes_ignore_preflight_errors is not defined | ||||
|     - replace_kube_proxy | ||||
| 
 | ||||
| - name: Initialize Kubernetes control plane with kubeadm init without kube-proxy and ignore_preflight_errors | ||||
|   command: > | ||||
| @ -59,10 +59,10 @@ | ||||
|     --skip-phases=addon/kube-proxy | ||||
|     {{ kubernetes_kubeadm_init_extra_opts }} | ||||
|   register: kubeadmin_init | ||||
|   when: > | ||||
|     (not kubernetes_init_stat.stat.exists) and | ||||
|     (kubernetes_ignore_preflight_errors is defined) and | ||||
|     (replace_kube_proxy) | ||||
|   when: | ||||
|     - not kubernetes_init_stat.stat.exists | ||||
|     - kubernetes_ignore_preflight_errors is defined | ||||
|     - replace_kube_proxy | ||||
| 
 | ||||
| - name: Print the init output to screen. | ||||
|   debug: | ||||
|  | ||||
							
								
								
									
										53
									
								
								tasks/hubble-client-setup.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								tasks/hubble-client-setup.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,53 @@ | ||||
| --- | ||||
| - name: Check if Hubble CLI has already been Installed. | ||||
|   stat: | ||||
|     path: /usr/local/bin/hubble | ||||
|   register: hubble_init_stat | ||||
|   when: | ||||
|     - kubernetes_pod_network.cni == 'cilium' | ||||
| 
 | ||||
| - name: Install Hubble CLI | ||||
|   when: | ||||
|     - kubernetes_pod_network.cni == 'cilium' | ||||
|     - not hubble_init_stat.stat.exists | ||||
|   block: | ||||
|     - name: Get Hubble CLI version | ||||
|       shell: curl -s https://raw.githubusercontent.com/cilium/hubble/master/stable.txt | ||||
|       register: hubble_cli_version | ||||
|       changed_when: false | ||||
| 
 | ||||
|     - name: Set CLI architecture | ||||
|       set_fact: | ||||
|         cli_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" | ||||
| 
 | ||||
| 
 | ||||
|     - name: Download Hubble CLI | ||||
|       get_url: | ||||
|         url: "https://github.com/cilium/hubble/releases/download/{{ hubble_cli_version.stdout }}/hubble-linux-{{ cli_arch }}.tar.gz" | ||||
|         dest: "/tmp/hubble-linux-{{ cli_arch }}.tar.gz" | ||||
|         mode: '0644' | ||||
| 
 | ||||
|     - name: Download Hubble CLI checksum | ||||
|       get_url: | ||||
|         url: "https://github.com/cilium/hubble/releases/download/{{ hubble_cli_version.stdout }}/hubble-linux-{{ cli_arch }}.tar.gz.sha256sum" | ||||
|         dest: "/tmp/hubble-linux-{{ cli_arch }}.tar.gz.sha256sum" | ||||
|         mode: '0644' | ||||
| 
 | ||||
|     - name: Verify Hubble CLI checksum | ||||
|       shell: sha256sum --check /tmp/hubble-linux-{{ cli_arch }}.tar.gz.sha256sum | ||||
|       args: | ||||
|         chdir: /tmp | ||||
| 
 | ||||
|     - name: Extract Hubble CLI | ||||
|       unarchive: | ||||
|         src: "/tmp/hubble-linux-{{ cli_arch }}.tar.gz" | ||||
|         dest: /usr/local/bin | ||||
|         remote_src: true | ||||
| 
 | ||||
|     - name: Remove downloaded files | ||||
|       file: | ||||
|         path: "/tmp/hubble-linux-{{ cli_arch }}.tar.gz{{ item }}" | ||||
|         state: absent | ||||
|       loop: | ||||
|         - '' | ||||
|         - '.sha256sum' | ||||
| @ -37,8 +37,17 @@ | ||||
| # Set up Cilium Client. | ||||
| - include_tasks: cilium-client-setup.yml | ||||
|   when: | ||||
|     - kubernetes_pod_network.cni == 'cilium' | ||||
|     - kubernetes_role == 'control_plane' | ||||
|     - kubernetes_pod_network.cni == 'cilium' | ||||
| 
 | ||||
| # Set up hubble Client. | ||||
| - include_tasks: hubble-client-setup.yml | ||||
|   when: | ||||
|     - kubernetes_role == 'control_plane' | ||||
|     - kubernetes_pod_network.cni == 'cilium' | ||||
|     - kubernetes_cilium_hubble_client | ||||
|     - kubernetes_cilium_values.hubble.relay.enabled is defined | ||||
|     - kubernetes_cilium_values.hubble.relay.enabled | ||||
| 
 | ||||
| # Set up control plane. | ||||
| - include_tasks: control-plane-setup.yml | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user