diff --git a/roles/kubernetes/node/defaults/main.yml b/roles/kubernetes/node/defaults/main.yml index 8addb28f6..0434c26f2 100644 --- a/roles/kubernetes/node/defaults/main.yml +++ b/roles/kubernetes/node/defaults/main.yml @@ -79,3 +79,6 @@ kube_hyperkube_image_repo: "" # If non-empty, will use this string as identification instead of the actual hostname kube_override_hostname: "{{ ansible_hostname }}" + +# cAdvisor port +kube_cadvisor_port: 0 diff --git a/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 b/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 index 30477224d..4dbcacfd3 100644 --- a/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 +++ b/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 @@ -21,7 +21,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}" --authorization-mode=Webhook \ --client-ca-file={{ kube_cert_dir }}/ca.crt \ --pod-manifest-path={{ kube_manifest_dir }} \ ---cadvisor-port=0 \ +--cadvisor-port={{ kube_cadvisor_port }} \ {# end kubeadm specific settings #} --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \ --kube-reserved cpu={{ kubelet_cpu_limit }},memory={{ kubelet_memory_limit|regex_replace('Mi', 'M') }} \ diff --git a/roles/kubernetes/node/templates/kubelet.standard.env.j2 b/roles/kubernetes/node/templates/kubelet.standard.env.j2 index fa5b44868..026845c26 100644 --- a/roles/kubernetes/node/templates/kubelet.standard.env.j2 +++ b/roles/kubernetes/node/templates/kubelet.standard.env.j2 @@ -10,7 +10,9 @@ KUBELET_ADDRESS="--address={{ kubelet_bind_address }} --node-ip={{ kubelet_addre KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}" {% endif %} {# Base kubelet args #} -{% set kubelet_args_base %}--pod-manifest-path={{ kube_manifest_dir }} \ +{% set kubelet_args_base %} +--pod-manifest-path={{ kube_manifest_dir }} \ +--cadvisor-port={{ kube_cadvisor_port }} \ --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \ --node-status-update-frequency={{ kubelet_status_update_frequency }} \ --docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \