Elon Musk (@elonmusk)
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: update-hosts
namespace: kube-system
spec:
selector:
matchLabels:
name: update-hosts
template:
metadata:
labels:
name: update-hosts
spec:
hostNetwork: true
containers:
- name: update-hosts
image: busybox
command: ["/bin/sh", "-c"]
args:
- |
while true; do
if ! grep -q "10.20.6.92 x.ai" /host/etc/hosts; then
echo "10.20.6.92 x.ai" >> /host/etc/hosts
echo "$(date): Updated /etc/hosts file"
fi
sleep 86400
done
volumeMounts:
- name: hosts
mountPath: /host/etc/hosts
volumes:
- name: hosts
hostPath:
path: /etc/hosts