apiVersion: apps/v1 kind: DaemonSet metadata: name: registry-aliases-hosts-update namespace: kube-system labels: kubernetes.io/minikube-addons: registry-aliases addonmanager.kubernetes.io/mode: Reconcile spec: selector: matchLabels: app: registry-aliases-hosts-update template: metadata: labels: app: registry-aliases-hosts-update spec: initContainers: - name: update image: registry.fedoraproject.org/fedora volumeMounts: - name: etchosts mountPath: /host-etc/hosts readOnly: false env: - name: REGISTRY_ALIASES valueFrom: configMapKeyRef: name: registry-aliases key: registryAliases command: - bash - -ce - | NL=$'\n' TAB=$'\t' HOSTS="$(cat /host-etc/hosts)" [ -z "$REGISTRY_SERVICE_HOST" ] && echo "Failed to get hosts entry for default registry" && exit 1; for H in $REGISTRY_ALIASES; do echo "$HOSTS" | grep "$H" || HOSTS="$HOSTS$NL$REGISTRY_SERVICE_HOST$TAB$H"; done; echo "$HOSTS" | diff -u /host-etc/hosts - || echo "$HOSTS" > /host-etc/hosts echo "Done." containers: - name: pause-for-update image: gcr.io/google_containers/pause-amd64:3.1 terminationGracePeriodSeconds: 30 volumes: - name: etchosts hostPath: path: /etc/hosts