If you have only one module, you can use hostNetwork: true to achieve this:
apiVersion: apps/v1beta1 kind: Deployment metadata: name: caddy spec: replicas: 1 template: metadata: labels: app: caddy spec: hostNetwork: true # <--------- containers: - name: caddy image: your_image env: - name: STATIC_BACKEND # example env in my custom image value: $(STATIC_SERVICE_HOST):80
Note that by doing this , your module will inherit the host's DNS receiver , not Kubernetes. This means that you can no longer resolve cluster services by DNS name. For example, in the example above, you cannot access the static service at http: // static . You can still access services at their cluster IP address, which are entered by environment variables .
source share