Thursday, March 3, 2022

HostAliases for Kubernetes

https://stackoverflow.com/questions/56390226/how-to-add-extra-hosts-entries-in-helm-charts 

Kubernetes provides a DNS service that all pods get to use. In turn, you can define an ExternalName service that just defines a DNS record. Once you do that, your pods can talk to that service the same way they'd talk to any other Kubernetes service, and reach whatever server.

You could deploy a set of ExternalName services globally. You could do it in a Helm chart too, if you wanted, something like

apiVersion: v1
kind: Service
metadata:
  name: {{ .Release.Name }}-{{ .Chart.Name }}-foo
spec:
  type: ExternalName
  externalName: {{ .Values.fooHostname }}

No comments:

Post a Comment