Skip to content

Commit

Permalink
Document kube-proxy patch that modifies config in init container
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lipovetsky committed Jul 28, 2018
1 parent 97e3617 commit bd62d1b
Showing 1 changed file with 48 additions and 13 deletions.
61 changes: 48 additions & 13 deletions content/en/docs/setup/independent/troubleshooting-kubeadm.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,34 +208,69 @@ W0507 22:33:10.372369 1 server.go:586] Failed to retrieve node info: nodes
W0507 22:33:10.372474 1 proxier.go:463] invalid nodeIP, initializing kube-proxy with 127.0.0.1 as nodeIP
```

A workaround for this is to modify the kube-proxy DaemonSet in the following way:
A workaround for this is to apply, in order, the following patches to the kube-proxy DaemonSet:

Patch 1
```sh
kubectl -n kube-system patch --type json daemonset kube-proxy -p "$(cat <<'EOF'
[
{
"op": "add",
"path": "/spec/template/spec/containers/0/env",
"op": "add"
"path": "/spec/template/spec/volumes/-",
"value": [
{
"name": "NODE_NAME",
"valueFrom": {
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "spec.nodeName"
}
}
"name": "shared-data",
"mountPath": "/shared-data"
}
]
},
{
"op": "add",
"path": "/spec/template/spec/containers/0/command/-",
"value": "--hostname-override=${NODE_NAME}"
"op": "add"
"path": "/spec/template/spec/containers/0/volumeMounts/-",
"value": [
{
"name": "shared-data",
"mountPath": "/shared-data"
}
]
},
{
"op": "replace",
"path": "/spec/template/spec/containers/0/command/1",
"value": "--config=/shared-data/config.conf"
}
]
EOF
)"
```

Patch 2
```sh
kubectl -n kube-system patch --type strategic daemonset kube-proxy -p "$(cat <<'EOF'
spec:
template:
spec:
initContainers:
- command:
- 'sh'
- '-c'
- '/bin/sed "s/hostnameOverride: \"\"/hostnameOverride: $(NODE_NAME)/" /var/lib/kube-proxy/config.conf > /shared-data/config.conf'
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
image: k8s.gcr.io/kube-proxy-amd64:v1.11.1
imagePullPolicy: IfNotPresent
name: update-config-file
volumeMounts:
- mountPath: /var/lib/kube-proxy
name: kube-proxy
- mountPath: /shared-data
name: shared-data
EOF
)"
```

{{% /capture %}}

0 comments on commit bd62d1b

Please sign in to comment.