Skip to content

Instantly share code, notes, and snippets.

@jjo
Last active January 31, 2019 21:00
Show Gist options
  • Save jjo/2619b862722d5fd2b8c2f5c0aadb0c7c to your computer and use it in GitHub Desktop.
Save jjo/2619b862722d5fd2b8c2f5c0aadb0c7c to your computer and use it in GitHub Desktop.
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
namespace: kube-system
name: kube-proxy-cleanup
labels:
k8s-app: kube-proxy-cleanup
spec:
selector:
matchLabels:
k8s-app: kube-proxy-cleanup
template:
metadata:
labels:
k8s-app: kube-proxy-cleanup
spec:
hostNetwork: true
containers:
- name: kube-proxy-cleanup
args: ["sh", "-c", "kube-proxy --cleanup; echo exit_status=$?; sleep 3600"]
image: k8s.gcr.io/kube-proxy-amd64:v1.13.2
securityContext:
privileged: true
volumeMounts:
- mountPath: /lib/modules
name: lib-modules
readOnly: true
volumes:
- hostPath:
path: /lib/modules
type: ""
name: lib-modules
@jjo
Copy link
Author

jjo commented Jun 5, 2018

Cleans up kube-proxy iptables via daemonset (must be manually deleted afterwards), use:

kubectl create -f kube-proxy-cleanup.ds.yaml
# Wait some secs, can peek for exit_status=0 with:
## kubectl logs --namespace=kube-system -l k8s-app=kube-proxy-cleanup
kubectl delete -f kube-proxy-cleanup.ds.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment