Kubernetes - Using hostAliases
22 Feb 2021 - Cody Merritt Anhorn
This article goes over how to update the /etc/hosts on your deployment pods with custom entries.
Adding values to the
hostAliases section of a deployment I am able to redirect requests to my identity server located on my main machine, since a back plane network request causes issues with the url structure and SSL resolution. This has the added benefit of behaving more like a production environment as well.
Checkout Adding entries to Pod /etc/hosts with HostAliases, the official documentation, for more details.
apiVersion: apps/v1 kind: Deployment metadata: name: platform-service spec: replicas: 1 spec: hostAliases: - ip: 192.168.1.130 hostnames: - identity-server.com containers: - name: platform-service image: cloudplatform:latest ports: - containerPort: 80
Categories: blog kubernetes
Cody Merritt Anhorn