Migrade kube-proxy manifest to use go-runner for logging

This commit is contained in:
Peter Rifel 2021-11-01 17:01:19 -05:00
parent b73c2ac0bd
commit b0e585c751
No known key found for this signature in database
GPG Key ID: BC6469E5B16DB2B6
2 changed files with 18 additions and 11 deletions

View File

@ -210,13 +210,21 @@ func (b *KubeProxyBuilder) buildPod() (*v1.Pod, error) {
addHostPathMapping(pod, container, "logfile", "/var/log/kube-proxy.log").ReadOnly = false addHostPathMapping(pod, container, "logfile", "/var/log/kube-proxy.log").ReadOnly = false
// We use lighter containers that don't include shells // We use lighter containers that don't include shells
// But they have richer logging support via klog // But they have richer logging support via klog
container.Command = []string{"/usr/local/bin/kube-proxy"} if b.IsKubernetesGTE("1.23") {
container.Args = append( container.Command = []string{"/go-runner"}
sortedStrings(flags), container.Args = []string{
"--logtostderr=false", //https://github.com/kubernetes/klog/issues/60 "--log-file=/var/log/kube-proxy.log",
"--alsologtostderr", "/usr/local/bin/kube-proxy",
"--log-file=/var/log/kube-proxy.log") }
container.Args = append(container.Args, sortedStrings(flags)...)
} else {
container.Command = []string{"/usr/local/bin/kube-proxy"}
container.Args = append(
sortedStrings(flags),
"--logtostderr=false", //https://github.com/kubernetes/klog/issues/60
"--alsologtostderr",
"--log-file=/var/log/kube-proxy.log")
}
{ {
addHostPathMapping(pod, container, "kubeconfig", "/var/lib/kube-proxy/kubeconfig") addHostPathMapping(pod, container, "kubeconfig", "/var/lib/kube-proxy/kubeconfig")
// @note: mapping the host modules directory to fix the missing ipvs kernel module // @note: mapping the host modules directory to fix the missing ipvs kernel module

View File

@ -11,6 +11,8 @@ contents: |
spec: spec:
containers: containers:
- args: - args:
- --log-file=/var/log/kube-proxy.log
- /usr/local/bin/kube-proxy
- --cluster-cidr=100.96.0.0/11 - --cluster-cidr=100.96.0.0/11
- --conntrack-max-per-core=131072 - --conntrack-max-per-core=131072
- --hostname-override=@aws - --hostname-override=@aws
@ -18,11 +20,8 @@ contents: |
- --master=https://127.0.0.1 - --master=https://127.0.0.1
- --oom-score-adj=-998 - --oom-score-adj=-998
- --v=2 - --v=2
- --logtostderr=false
- --alsologtostderr
- --log-file=/var/log/kube-proxy.log
command: command:
- /usr/local/bin/kube-proxy - /go-runner
image: k8s.gcr.io/kube-proxy:v1.23.0 image: k8s.gcr.io/kube-proxy:v1.23.0
name: kube-proxy name: kube-proxy
resources: resources: