Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ds-hostnet-split example refers to undefined CONTOUR_SERVICE and CONTOUR_PORT variables #1122

Closed
bgagnon opened this issue May 24, 2019 · 4 comments

Comments

@bgagnon
Copy link
Contributor

bgagnon commented May 24, 2019

The variables CONTOUR_SERVICE_HOST and CONTOUR_SERVICE_PORT are not defined anywhere, but used

...in deployment/ds-hostnet-split/03-envoy.yaml:

initContainers:
      - args:
        - bootstrap
        - /config/contour.json
        - --xds-address
        - $(CONTOUR_SERVICE_HOST)
        - --xds-port
        - $(CONTOUR_SERVICE_PORT)
        command:
        - contour
        image: gcr.io/heptio-images/contour:master

...and deployment/ds-hostnet-split/03-contour.yaml:

      containers:
      - args:
        - serve
        - --incluster
        - --xds-address=0.0.0.0
        - --xds-port=$(CONTOUR_SERVICE_PORT)
        - --envoy-service-http-port=80
        - --envoy-service-https-port=443
        command: ["contour"]
        image: gcr.io/heptio-images/contour:master

I've replaced them with contour and 8001, respectively.
Is the idea that these should come from a common ConfigMap?

@stevesloka
Copy link
Member

Those variables should be auto-injected by Kubernetes which match the Kubernetes service.

Can you exec into an envoy pod and print out the env vars?

@bgagnon
Copy link
Contributor Author

bgagnon commented May 25, 2019

Gotcha! Kubernetes does inject those Docker-link inspired variables, provided that the Service exists before the DaemonSet and Deployment, as documented here and here.

In my case I created the objects in a different order and did not have those variables in place when the pods started. Furthermore, having missing/empty strings there was not enough to fail the readiness and liveness probes, which would have otherwise resolved the issue automatically some time after the Service appeared.

Isn't this all too flaky to recommend in the canonical deployment manifests? I've long considered service env vars a legacy feature (kubernetes/kubernetes#60099 and spec.enableServiceLinks on PodSpec) due to the inevitable conflicts and ordering problems they introduce.

@stevesloka
Copy link
Member

I agree with you @bgagnon that we should look to move away from these ENV variables. We have the sample split deployment yaml files numbered to get around this issue.

I'll open a new issue to look at resolving this which I'd recommend using the internal dns name of the Contour service, however, last time I tried this there was some issues with Contour resolving the name which is why I went with the env vars.

We can dig into that in the new issue and get this updated.

@davecheney
Copy link
Contributor

davecheney commented May 30, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants