Skip to content

Commit

Permalink
allow to set the kubernetes log level
Browse files Browse the repository at this point in the history
allow to configure the verbosity of the logs on the kubernetes
components.

Change-Id: I338c81814c7bbd8a08ede039157f7b153ff42ba7
  • Loading branch information
aojea committed Oct 27, 2024
1 parent e451109 commit 867ec2d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kubetest2-ec2/config/kubeadm-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nodeRegistration:
runtime-cgroups: /runtime.slice
kubelet-cgroups: /runtime.slice
cgroup-root: /
v: {{KUBE_LOG_LEVEL}}
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
Expand All @@ -29,14 +30,17 @@ apiServer:
cloud-provider: {{EXTERNAL_CLOUD_PROVIDER}}
feature-gates: {{FEATURE_GATES}}
runtime-config: {{RUNTIME_CONFIG}}
v: {{KUBE_LOG_LEVEL}}
certSANs:
- {{EXTRA_SANS}}
controllerManager:
extraArgs:
cloud-provider: {{EXTERNAL_CLOUD_PROVIDER}}
feature-gates: {{FEATURE_GATES}}
v: {{KUBE_LOG_LEVEL}}
scheduler:
extraArgs:
feature-gates: {{FEATURE_GATES}}
v: {{KUBE_LOG_LEVEL}}
networking:
podSubnet: {{POD_CIDR}}
1 change: 1 addition & 0 deletions kubetest2-ec2/config/kubeadm-join.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ nodeRegistration:
runtime-cgroups: /runtime.slice
kubelet-cgroups: /runtime.slice
cgroup-root: /
v: {{KUBE_LOG_LEVEL}}
3 changes: 3 additions & 0 deletions kubetest2-ec2/config/run-kubeadm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ if [[ ${KUBEADM_CONTROL_PLANE} == true ]]; then
KUBERNETES_VERSION=$(kubelet --version | awk '{print $2}')
sed -i "s|{{KUBERNETES_VERSION}}|$KUBERNETES_VERSION|g" /etc/kubernetes/kubeadm-init.yaml
sed -i "s|{{POD_CIDR}}|$POD_CIDR|g" /etc/kubernetes/kubeadm-init.yaml
KUBE_LOG_LEVEL=${KUBE_LOG_LEVEL:-4}
sed -i "s|{{KUBE_LOG_LEVEL}}|$KUBE_LOG_LEVEL|g" /etc/kubernetes/kubeadm-init.yaml
sed -i "s|{{KUBE_LOG_LEVEL}}|$KUBE_LOG_LEVEL|g" /etc/kubernetes/kubeadm-join.yaml

kubeadm init \
--v 10 \
Expand Down
2 changes: 2 additions & 0 deletions kubetest2-ec2/config/run-post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ if [[ "${KUBEADM_CONTROL_PLANE}" == true ]]; then
kubectl --kubeconfig /etc/kubernetes/admin.conf apply -k "github.com/kubernetes-sigs/aws-ebs-csi-driver/deploy/kubernetes/overlays/stable/?ref=release-1.32"
kubectl --kubeconfig /etc/kubernetes/admin.conf wait --for=condition=Available --timeout=2m -n kube-system deployments ebs-csi-controller
else
KUBE_LOG_LEVEL=${KUBE_LOG_LEVEL:-4}
kubectl patch -n kube-system daemonset/kube-proxy --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "--v='${KUBE_LOG_LEVEL}'" }]'
kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f "https://raw.githubusercontent.com/aojea/kindnet/main/install-kindnet.yaml"
kubectl --kubeconfig /etc/kubernetes/admin.conf rollout status daemonset kindnet -n kube-system --timeout=5m
fi
Expand Down

0 comments on commit 867ec2d

Please sign in to comment.