First time applying patch
# kubectl --namespace=kube-system patch daemonset kube-proxy --patch='
spec:
template:
spec:
volumes:
- name: shared-data
emptyDir: {}
initContainers:
- name: update-config-file
image: busybox
imagePullPolicy: IfNotPresent
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
volumeMounts:
- name: kube-proxy
mountPath: /var/lib/kube-proxy
readOnly: true
- name: shared-data
mountPath: /shared-data
containers:
- name: kube-proxy
command:
- /usr/local/bin/kube-proxy
- --config=/shared-data/config.conf
volumeMounts:
- name: shared-data
mountPath: /shared-data
readOnly: true'
daemonset.extensions "kube-proxy" patched
Second time applying patch (showing non-zero exit code)
# kubectl --namespace=kube-system patch daemonset kube-proxy --patch='
spec:
template:
spec:
volumes:
- name: shared-data
emptyDir: {}
initContainers:
- name: update-config-file
image: busybox
imagePullPolicy: IfNotPresent
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
volumeMounts:
- name: kube-proxy
mountPath: /var/lib/kube-proxy
readOnly: true
- name: shared-data
mountPath: /shared-data
containers:
- name: kube-proxy
command:
- /usr/local/bin/kube-proxy
- --config=/shared-data/config.conf
volumeMounts:
- name: shared-data
mountPath: /shared-data
readOnly: true'
daemonset.extensions "kube-proxy" not patched
# echo $?
1
Second time applying patch (with increased verbosity)
# kubectl -v=10 --namespace=kube-system patch daemonset kube-proxy --patch='
spec:
template:
spec:
volumes:
- name: shared-data
emptyDir: {}
initContainers:
- name: update-config-file
image: busybox
imagePullPolicy: IfNotPresent
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
volumeMounts:
- name: kube-proxy
mountPath: /var/lib/kube-proxy
readOnly: true
- name: shared-data
mountPath: /shared-data
containers:
- name: kube-proxy
command:
- /usr/local/bin/kube-proxy
- --config=/shared-data/config.conf
volumeMounts:
- name: shared-data
mountPath: /shared-data
readOnly: true'
I0808 18:59:43.092760 15670 loader.go:357] Config loaded from file /etc/kubernetes/admin.conf
...
I0808 18:59:43.111028 15670 round_trippers.go:386] curl -k -v -XGET -H "Accept: application/json" -H "User-Agent: kubectl/v1.10.0 (linux/amd64) kubernetes/fc32d2f" https://192.0.2.24:6443/apis/extensions/v1beta1/namespaces/kube-system/daemonsets/kube-proxy
I0808 18:59:43.130118 15670 round_trippers.go:405] GET https://192.0.2.24:6443/apis/extensions/v1beta1/namespaces/kube-system/daemonsets/kube-proxy 200 OK in 19 milliseconds
I0808 18:59:43.130160 15670 round_trippers.go:411] Response Headers:
I0808 18:59:43.130167 15670 round_trippers.go:414] Content-Type: application/json
I0808 18:59:43.130174 15670 round_trippers.go:414] Content-Length: 2753
I0808 18:59:43.130180 15670 round_trippers.go:414] Date: Wed, 08 Aug 2018 18:59:43 GMT
I0808 18:59:43.130571 15670 request.go:874] Response Body: {"kind":"DaemonSet","apiVersion":"extensions/v1beta1","metadata":{"name":"kube-proxy","namespace":"kube-system","selfLink":"/apis/extensions/v1beta1/namespaces/kube-system/daemonsets/kube-proxy","uid":"13a28888-9b3d-11e8-b9b8-fa163e373377","resourceVersion":"1390","generation":2,"creationTimestamp":"2018-08-08T18:58:45Z","labels":{"k8s-app":"kube-proxy"}},"spec":{"selector":{"matchLabels":{"k8s-app":"kube-proxy"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"k8s-app":"kube-proxy"},"annotations":{"scheduler.alpha.kubernetes.io/critical-pod":""}},"spec":{"volumes":[{"name":"shared-data","emptyDir":{}},{"name":"kube-proxy","configMap":{"name":"kube-proxy","defaultMode":420}},{"name":"xtables-lock","hostPath":{"path":"/run/xtables.lock","type":"FileOrCreate"}},{"name":"lib-modules","hostPath":{"path":"/lib/modules","type":""}}],"initContainers":[{"name":"update-config-file","image":"busybox","command":["sh","-c","/bin/sed \"s/hostnameOverride: \\\"\\\"/hostnameOverride: $(NODE_NAME)/\" /var/lib/kube-proxy/config.conf \u003e /shared-data/config.conf"],"env":[{"name":"NODE_NAME","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"spec.nodeName"}}}],"resources":{},"volumeMounts":[{"name":"kube-proxy","readOnly":true,"mountPath":"/var/lib/kube-proxy"},{"name":"shared-data","mountPath":"/shared-data"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"containers":[{"name":"kube-proxy","image":"k8s.gcr.io/kube-proxy-amd64:v1.11.2","command":["/usr/local/bin/kube-proxy","--config=/shared-data/config.conf"],"resources":{},"volumeMounts":[{"name":"shared-data","readOnly":true,"mountPath":"/shared-data"},{"name":"kube-proxy","mountPath":"/var/lib/kube-proxy"},{"name":"xtables-lock","mountPath":"/run/xtables.lock"},{"name":"lib-modules","readOnly":true,"mountPath":"/lib/modules"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent","securityContext":{"privileged":true}}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","nodeSelector":{"beta.kubernetes.io/arch":"amd64"},"serviceAccountName":"kube-proxy","serviceAccount":"kube-proxy","hostNetwork":true,"securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"CriticalAddonsOnly","operator":"Exists"},{"operator":"Exists"}],"priorityClassName":"system-node-critical"}},"updateStrategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":1}},"templateGeneration":2,"revisionHistoryLimit":10},"status":{"currentNumberScheduled":1,"numberMisscheduled":0,"desiredNumberScheduled":1,"numberReady":1,"observedGeneration":2,"updatedNumberScheduled":1,"numberAvailable":1}}
I0808 18:59:43.131385 15670 request.go:874] Request Body: {"spec":{"template":{"spec":{"containers":[{"command":["/usr/local/bin/kube-proxy","--config=/shared-data/config.conf"],"name":"kube-proxy","volumeMounts":[{"mountPath":"/shared-data","name":"shared-data","readOnly":true}]}],"initContainers":[{"command":["sh","-c","/bin/sed \"s/hostnameOverride: \\\"\\\"/hostnameOverride: $(NODE_NAME)/\" /var/lib/kube-proxy/config.conf \u003e /shared-data/config.conf"],"env":[{"name":"NODE_NAME","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"spec.nodeName"}}}],"image":"busybox","imagePullPolicy":"IfNotPresent","name":"update-config-file","volumeMounts":[{"mountPath":"/var/lib/kube-proxy","name":"kube-proxy","readOnly":true},{"mountPath":"/shared-data","name":"shared-data"}]}],"volumes":[{"emptyDir":{},"name":"shared-data"}]}}}}
I0808 18:59:43.131519 15670 round_trippers.go:386] curl -k -v -XPATCH -H "Content-Type: application/strategic-merge-patch+json" -H "Accept: application/json" -H "User-Agent: kubectl/v1.10.0 (linux/amd64) kubernetes/fc32d2f" https://192.0.2.24:6443/apis/extensions/v1beta1/namespaces/kube-system/daemonsets/kube-proxy
I0808 18:59:43.147249 15670 round_trippers.go:405] PATCH https://192.0.2.24:6443/apis/extensions/v1beta1/namespaces/kube-system/daemonsets/kube-proxy 200 OK in 15 milliseconds
I0808 18:59:43.147394 15670 round_trippers.go:411] Response Headers:
I0808 18:59:43.147454 15670 round_trippers.go:414] Content-Type: application/json
I0808 18:59:43.147509 15670 round_trippers.go:414] Content-Length: 2753
I0808 18:59:43.147563 15670 round_trippers.go:414] Date: Wed, 08 Aug 2018 18:59:43 GMT
I0808 18:59:43.147661 15670 request.go:874] Response Body: {"kind":"DaemonSet","apiVersion":"extensions/v1beta1","metadata":{"name":"kube-proxy","namespace":"kube-system","selfLink":"/apis/extensions/v1beta1/namespaces/kube-system/daemonsets/kube-proxy","uid":"13a28888-9b3d-11e8-b9b8-fa163e373377","resourceVersion":"1390","generation":2,"creationTimestamp":"2018-08-08T18:58:45Z","labels":{"k8s-app":"kube-proxy"}},"spec":{"selector":{"matchLabels":{"k8s-app":"kube-proxy"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"k8s-app":"kube-proxy"},"annotations":{"scheduler.alpha.kubernetes.io/critical-pod":""}},"spec":{"volumes":[{"name":"shared-data","emptyDir":{}},{"name":"kube-proxy","configMap":{"name":"kube-proxy","defaultMode":420}},{"name":"xtables-lock","hostPath":{"path":"/run/xtables.lock","type":"FileOrCreate"}},{"name":"lib-modules","hostPath":{"path":"/lib/modules","type":""}}],"initContainers":[{"name":"update-config-file","image":"busybox","command":["sh","-c","/bin/sed \"s/hostnameOverride: \\\"\\\"/hostnameOverride: $(NODE_NAME)/\" /var/lib/kube-proxy/config.conf \u003e /shared-data/config.conf"],"env":[{"name":"NODE_NAME","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"spec.nodeName"}}}],"resources":{},"volumeMounts":[{"name":"kube-proxy","readOnly":true,"mountPath":"/var/lib/kube-proxy"},{"name":"shared-data","mountPath":"/shared-data"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"containers":[{"name":"kube-proxy","image":"k8s.gcr.io/kube-proxy-amd64:v1.11.2","command":["/usr/local/bin/kube-proxy","--config=/shared-data/config.conf"],"resources":{},"volumeMounts":[{"name":"shared-data","readOnly":true,"mountPath":"/shared-data"},{"name":"kube-proxy","mountPath":"/var/lib/kube-proxy"},{"name":"xtables-lock","mountPath":"/run/xtables.lock"},{"name":"lib-modules","readOnly":true,"mountPath":"/lib/modules"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent","securityContext":{"privileged":true}}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","nodeSelector":{"beta.kubernetes.io/arch":"amd64"},"serviceAccountName":"kube-proxy","serviceAccount":"kube-proxy","hostNetwork":true,"securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"CriticalAddonsOnly","operator":"Exists"},{"operator":"Exists"}],"priorityClassName":"system-node-critical"}},"updateStrategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":1}},"templateGeneration":2,"revisionHistoryLimit":10},"status":{"currentNumberScheduled":1,"numberMisscheduled":0,"desiredNumberScheduled":1,"numberReady":1,"observedGeneration":2,"updatedNumberScheduled":1,"numberAvailable":1}}
daemonset.extensions "kube-proxy" not patched
F0808 18:59:43.149053 15670 helpers.go:119]