Add extra kubelet args to avoid kubectl logs timeouts

Kubelet should use VXLAN overlay IP to make kubectl logs
work correctly and avoid timeouts which often lead to
post failures.

Change-Id: I4cfd6cb74019f150383cc0992e33c16db15e444f
Signed-off-by: Vladimir Kozhukalov <kozhukalov@gmail.com>
This commit is contained in:
Vladimir Kozhukalov
2025-09-19 16:01:32 -05:00
parent f91aa01d58
commit d16f061a56
4 changed files with 15 additions and 4 deletions

View File

@@ -0,0 +1 @@
KUBELET_EXTRA_ARGS="{% if overlay_network_setup %}--node-ip {{ overlay_network_bridge_ip }}{% endif %}"

View File

@@ -12,6 +12,11 @@ networking:
serviceSubnet: "{{ kubeadm.service_cidr }}" # --service-cidr
podSubnet: "{{ kubeadm.pod_network_cidr }}" # --pod-network-cidr
dnsDomain: "cluster.local"
apiServer:
ControlPlaneComponent:
extraArgs:
- name: kubelet-preferred-address-types
value: "InternalIP,Hostname,InternalDNS,ExternalIP,ExternalDNS"
...
---
apiVersion: kubeadm.k8s.io/v1beta4

View File

@@ -44,6 +44,12 @@
file: k8s_control_plane.yaml
when: inventory_hostname in (groups['k8s_control_plane'] | default([]))
- name: Prepare kubeadm config
template:
src: files/etc_default_kubelet.j2
dest: /etc/default/kubelet
when: inventory_hostname in (groups['k8s_nodes'] | default([]))
- name: Join workload nodes to cluster
command: "{{ (groups['k8s_control_plane'] | map('extract', hostvars, ['join_command', 'stdout_lines', 0]))[0] }}"
when: inventory_hostname in (groups['k8s_nodes'] | default([]))

View File

@@ -24,13 +24,12 @@
- name: "retrieve all kubernetes logs, current and previous (if they exist)"
shell: |-
set -e
PARALLELISM_FACTOR=2
function get_namespaces () {
kubectl get namespaces -o name | awk -F '/' '{ print $NF }'
}
function get_pods () {
NAMESPACE=$1
kubectl get pods -n ${NAMESPACE} -o name | awk -F '/' '{ print $NF }' | xargs -L1 -P 1 -I {} echo ${NAMESPACE} {}
kubectl get pods -n ${NAMESPACE} -o name | awk -F '/' '{ print $NF }' | xargs -I {} echo ${NAMESPACE} {}
}
export -f get_pods
function get_pod_logs () {
@@ -48,8 +47,8 @@
}
export -f get_pod_logs
get_namespaces | \
xargs -r -n 1 -P ${PARALLELISM_FACTOR} -I {} bash -c 'get_pods "$@"' _ {} | \
xargs -r -n 2 -P ${PARALLELISM_FACTOR} -I {} bash -c 'get_pod_logs "$@"' _ {}
xargs -r -I {} bash -c 'get_pods "$@"' _ {} | \
xargs -r -I {} bash -c 'get_pod_logs "$@"' _ {}
args:
executable: /bin/bash
ignore_errors: True