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

document how to run multiple Contours per cluster (e.g. internal and external) #855

Closed
so0k opened this issue Jan 22, 2019 · 23 comments · Fixed by #4832
Closed

document how to run multiple Contours per cluster (e.g. internal and external) #855

so0k opened this issue Jan 22, 2019 · 23 comments · Fixed by #4832
Assignees
Labels
area/deployment Issues or PRs related to deployment tooling or infrastructure. area/documentation Issues or PRs related to documentation. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Milestone

Comments

@so0k
Copy link

so0k commented Jan 22, 2019

Objective

I need to configure internal and external ingress controllers on AWS with NLB

Internal Ingress is served by an internal NLB (only accessible from within the VPC)
External Ingress is served by an external NLB (publicly accessible)

What steps did you take and what happened:

I'm using deployment/ds-hostnet-split as a guideline.

full final manifest

  • I'm using the same rbac / crb / sa for both contour deployments
  • I have 2 Contour deployments:
    • name & label:contour-external for deploy / svc (clusterIP) manifest
      the arguments:
      - serve
      - --incluster
      - --xds-address
      - 0.0.0.0
      - --xds-port
      - $(CONTOUR_EXTERNAL_SERVICE_PORT)
      - --envoy-http-port
      - "80"   #<<<<<
      - --envoy-https-port
      - "443" #<<<<<
      - --ingress-class-name=envoy-external  
      
    • name & label: contour-internal for deploy / svc (clusterIP) manifest
      the arguments:
      - serve
      - --incluster
      - --xds-address
      - 0.0.0.0
      - --xds-port
      - $(CONTOUR_INTERNAL_SERVICE_PORT)
      - --envoy-http-port
      - "8080" #<<<<<
      - --envoy-https-port
      - "8443" #<<<<<
      - --ingress-class-name=envoy-internal  
      
  • I have 2 Envoy daemonsets with hostNetwork: true:
    • name & label: envoy-external for ds / svc (LoadBalancer:NLB) manifest
      environment:
      - name: NODE_NAME
        valueFrom:
          fieldRef:
            fieldPath: spec.nodeName
      
      args:
      - -c
      - /config/contour.yaml
      - --service-cluster
      - envoy-external-cluster
      - --service-node
      - $(NODE_NAME)
      
      bootstrap:
      - --xds-address
      - $(CONTOUR_EXTERNAL_SERVICE_HOST)
      - --xds-port
      - $(CONTOUR_EXTERNAL_SERVICE_PORT)
      - --stats-port
      - "8002"
      - --admin-port
      - "9001"
      
      HealthCheck uses 8002
      preStop uses 9001
    • name & label: envoy-internal for ds / svc (LoadBalancer:NLB) manifest
      environment is the same as above, using fieldRef for spec.NodeName
      args:
      - -c
      - /config/contour.yaml
      - --service-cluster
      - envoy-internal-cluster
      - --service-node
      - $(NODE_NAME)
      
      bootstrap:
      - --xds-address
      - $(CONTOUR_INTERNAL_SERVICE_HOST)
      - --xds-port
      - $(CONTOUR_INTERNAL_SERVICE_PORT)
      - --stats-port
      - "8004"
      - --admin-port
      - "9002"
      
      HealthCheck uses 8004
      preStop uses 9002

What did you expect to happen:

I expect both envoy ds to run side by side, but they exit(1) without any logs, I verified that they do not use the same hostPorts and I reviewed and validated the configuration created by contour bootstrap..
If I delete one ds the other starts without issue and vice versa.

SSH to the node and running a docker container without host network with the same envoy allows both containers to run side by side.

Anything else you would like to add:

here is a gist for full manifests:

https://gist.github.com/so0k/2cb93c405cf05fcb8ecb73fa665efbd0

Environment:

  • Contour version: 0.8.1
  • Kubernetes version: 1.11.6
  • Kubernetes installer & version: kops 1.11
  • Cloud provider or hardware configuration: AWS
  • OS (e.g. from /etc/os-release): CoreOS
@so0k
Copy link
Author

so0k commented Jan 22, 2019

without using hostNetwork - this works: new-manifest - but the clientIP is not preserved

@jbeda
Copy link
Contributor

jbeda commented Jan 22, 2019

Ok -- here are the ports I see in the original manifest

  • service/envoy-external
    • 80->80
    • 443->443
  • service/contour-external - 8001->8001
  • deployment/contour-external (hostNetwork: false)
    • xds - CONTOUR_EXTERNAL_SERVICE_PORT = 8001
    • envoy-http - 80
    • envoy-https - 443
    • debug - 8000 (only specified in ports section, not on command line)
  • daemonset/envoy-external (hostNetwork: true)
    • http: 80
    • https: 443
    • stats: 8002
    • admin: 9001
  • service/envoy-internal
    • 80->8080
    • 443->8443
  • service/contur-internal
    • 8001->8001
  • deployment/contour-internal (hostNetwork: false)
    • xds: CONTOUR_INTERNAL_SERVICE_PORT = 8001
    • envoy http: 8080
    • envoy https: 8443
    • debug - 8000 (only specified in ports section, not on command line)
  • daemonset/envoy-internal (hostNetwork: true)
    • http: 8080
    • https: 8443
    • stats: 8004
    • admin: 9002

From first blush, it looks like there are no overlapping ports on the things that are running as host networking and other ports look to be wired up fine.

@davecheney -- do you know if envoy is opening any other ports that aren't specified? Is there a way to make it dump more verbose logging to debug why it is exiting?

@so0k -- might be useful to ssh into the node and use lsof to find what ports the envoy is listening on to see if there is anything unexpected. I don't know the syntax off the top of my head but it looks like some quick googling leads to some sane guides.

@so0k
Copy link
Author

so0k commented Jan 22, 2019

running netstat -nltp and playing around the ds to see what ports envoy-external vs envoy-internal each open on the host did not reveal any overlapping ports.

I will try this again tomorrow with a fresh mind as I spent quite a lot of time breaking my head on this already

@stevesloka
Copy link
Member

stevesloka commented Jan 23, 2019

Hey @so0k can you try adding this argument to one of the Envoy daemonset manifests?

- --base-id
- "2"

ref: https://www.envoyproxy.io/docs/envoy/v1.8.0/operations/cli.html#cmdoption-base-id

@so0k
Copy link
Author

so0k commented Jan 24, 2019

great find! Adding base-id: new gist - didn't have time to test it yet

@anapsix
Copy link

anapsix commented Feb 8, 2019

@stevesloka / @so0k, confirmed <3!
Works as advertised (though still having problems with proxy-proto described in #793)

@davecheney
Copy link
Contributor

@anapsix can you please raise a new issue to talk about your problems using proxy-protocol. Thank you.

@so0k what is required to close this issue?

@so0k
Copy link
Author

so0k commented Feb 18, 2019

@davecheney - should I do a PR with documentation about adding --base-id flag to envoy if running multiple ds in hostNetwork ?

@davecheney davecheney added kind/bug Categorizes issue or PR as related to a bug. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Apr 11, 2019
@davecheney
Copy link
Contributor

Documentation issue, I’m assigning this to beta.1. @so0k feel free to send a docs PR before then.

@davecheney davecheney added documentation kind/feature Categorizes issue or PR as related to a new feature. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed kind/bug Categorizes issue or PR as related to a bug. labels Jun 18, 2019
@davecheney davecheney added this to the 1.0.0.beta.1 milestone Jun 18, 2019
@davecheney
Copy link
Contributor

@so0k ping

@davecheney davecheney removed this from the 1.0.0-beta.1 milestone Sep 10, 2019
@jpeach
Copy link
Contributor

jpeach commented Feb 10, 2020

Here's a working configuration that uses kustomize to deploy internal and external Contours:

https://github.com/jpeach/kustomize/tree/master/knative/configurations/contour

@jpeach jpeach added the area/deployment Issues or PRs related to deployment tooling or infrastructure. label Feb 10, 2020
@so0k
Copy link
Author

so0k commented Feb 17, 2020

Sorry, I moved company and I'm afraid I won't be able to finish this documentation task until I have a use case to switch ingress over to Contour

jpeach added a commit to jpeach/contour that referenced this issue Apr 27, 2020
Move the example deployment to Kustomize. This breaks the YAML documents
in the example deployment into 4 components located in `config/components`
- types, contour, envoy and certgen. These are all included in the default
deployments, but operators have the option of creating deployments that
dont't include all the components.

Deployments to various Kubernetes infrastructure are in the `deployment`
directory. The base deployment pulls in all the components and sets the
namespace to `projectcontour`. The `kind` deployment updates the Envoy
Daemonset to use a `NodePort` service, and the `aws` deployment enables
TCP load balancing with PROXY protocol support. No special options are
needed for `gke` as far as I know, but it is included for completeness.

The traditional quickstart YAML is now located at `config/quickstary.yaml`
and is just a rendering of the base deployment. The netlify redirect can't
be updated until after a release because it points to a release branch.

This updates projectcontour#855, projectcontour#1190, projectcontour#2088, projectcontour#2544.

Signed-off-by: James Peach <jpeach@vmware.com>
jpeach added a commit to jpeach/contour that referenced this issue Apr 27, 2020
Move the example deployment to Kustomize. This requires the `kustomize`
tool, since the version of Kustomize vendored in `kubectl apply -k`
is too old to support.

The YAML documents in the example deployment are broken into 4 components
located in `config/components` - types, contour, envoy and certgen. These
are all included in the default deployments, but operators have the
option of creating deployments that dont't include all the components.
The `types-v1` component contains the Contour CRDs suitable for Kubernetes
1.16 or later.

Deployments to various Kubernetes infrastructure are in the `deployment`
directory. The base deployment pulls in all the components and sets the
namespace to `projectcontour`. The `kind` deployment updates the Envoy
Daemonset to use a `NodePort` service, and the `aws` deployment enables
TCP load balancing with PROXY protocol support. No special options are
needed for `gke` as far as I know, but it is included for completeness.

The traditional quickstart YAML is now located at `config/quickstary.yaml`
and is just a rendering of the base deployment. The netlify redirect can't
be updated until after a release because it points to a release branch.

This updates projectcontour#855, projectcontour#1190, projectcontour#2088, projectcontour#2544.

Signed-off-by: James Peach <jpeach@vmware.com>
@projectcontour-bot projectcontour-bot added area/documentation Issues or PRs related to documentation. and removed kind/documentation labels May 9, 2020
@stevesloka stevesloka added the Hacktoberfest Denotes an issue ready for any "Hacktoberfest" contributor. label Oct 1, 2020
@stevesloka stevesloka removed the Hacktoberfest Denotes an issue ready for any "Hacktoberfest" contributor. label Nov 5, 2020
@fernandodeperto
Copy link

Hi, guys,

I'm having the a similar issue and I haven't been able to solve it with the suggestions in this thread. Basically, I need to deploy two instances of Contour on the same cluster.

What is happening is that the first one that gets deployed works, Ingresses created with its class get the address assigned. After the second instance is deployed, ingresses deployed with its class do not get the address assigned.

I couldn't find anything weird or wrong on either of the Contour or Envoy's logs. These are the Helm chart version and values I'm using:

NAME               CHART             VERSION
contour-external   bitnami/contour     4.3.5
contour-internal   bitnami/contour     4.3.5

Values for contour-internal

ingressClass: contour-internal
envoy:
  service:
    annotations:
      service.beta.kubernetes.io/aws-load-balancer-internal: "true"

Values for contour-external

ingressClass: contour-external
contour:
  manageCRDs: false
envoy:
  extraArgs:
    - --base-id 2
  hostPorts:
    http: 8080
    https: 8443

I would appreciate any suggestions you might have. I didn't go through the sections like when an issue is created since it's just an answer to the ticket, but I can open a new one if that's preferred.

@youngnick
Copy link
Member

Hi @fernandodeperto, are both Envoy daemonsets starting up okay? I can't remember if it's this way in the Helm chart or not, but in our example YAMLs, the Envoy daemonset uses a host port, which, if it's being defaulted to something, would mean that the second Envoy deployment wouldn't start, which might produce this outcome?

@fernandodeperto
Copy link

Hi, @youngnick, thank you for the response. Indeed that is one of the things that I've checked, and both the Contour Deployment and the Envoy DaemonSet are coming up normally.

I can actually report that I've managed to fix the issue by deploying the two Contour instances on different namespaces. I couldn't find any differences on the logs between the two setups, but somehow in separate namespaces they work, meaning they both manage to assign ELB addresses to Ingress resources.

@youngnick
Copy link
Member

Oh, yes, we should really say that you should only do the two instances in separate namespaces. If the two deployments were in the same namespace, there are a few things that could conflict, like the configuration configmap and the leader election.

For other people finding this thread: Contour strongly recommends that, for multiple installations of Contour, they are in separate namespaces.

@EugenMayer
Copy link

EugenMayer commented Dec 17, 2021

Just if anybody is interested, using the bitnam helm chart, deploying a internal and external contour would look like this

contour:
  ingressClass:
    name: contour-${name}
    create: true
    default: ${isDefaultIngress}
  manageCRDs: ${manageCRDs}
envoy:
  service:
    externalIPs:
      - ${hostIP}
    ports:
      http: 80
      https: 443
  extraArgs:
    - --base-id ${id}
  hostPorts:
    http: ${hostPortHttp}
    https: ${hostPortHttps}
  • name: internal/external
  • isDefaultIngress: should be true for only one (notice [bitnami/contour] cannot make ingress non-default bitnami/charts#8450)
  • hostIp: should be one of the IPs of the control plain to bind on (if internal and external are routed via different ips)
  • be sure to use different ports for hostPortHttp / hostPortHttps, even if you bind those on different externalIPs
  • be sure to change the id to a unique value for each deployment, e.g. 1 for internal, 2 for external
  • of course, every deployment of the chart must go into a different namespaces

@skriss skriss changed the title Internal and External ingress with 2 contour deployments document how to run multiple Contours per cluster (e.g. internal and external) Jan 6, 2022
@youngnick
Copy link
Member

@OrlinVasilev I think this one is a very good candidate for some updated docs - @EugenMayer has got some great tips here that could cover the Helm usage, but I think a page that covered "how to run multiple Contour instances in a cluster" would help a lot of people.

@OrlinVasilev
Copy link
Member

@youngnick - so new Guide or to include it somewhere into the documentation ?
@EugenMayer - do you need help in making this info into blog or guide ? :)

@OrlinVasilev OrlinVasilev self-assigned this Jan 17, 2022
@youngnick
Copy link
Member

I think a new Guide is probably best. I'd like to see the Guides section renamed to "cookbook" or something later, but a Guide will get this info in there, we are getting more requests for this.

I think that @EugenMayer was contributing notes, not offering to write the full thing, happy to be proved wrong though.

@EugenMayer
Copy link

I would rather handing over to you to put it into a format of your linking - just take it as it were yours and put it where people can use it :)

@pnbrown pnbrown removed the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Oct 11, 2022
@skriss skriss assigned skriss and unassigned OrlinVasilev Nov 2, 2022
@skriss skriss removed this from Unprioritized in Contour Project Board Nov 2, 2022
@skriss skriss added this to the 1.24.0 milestone Nov 2, 2022
@skriss
Copy link
Member

skriss commented Nov 2, 2022

I'll try to get this documented soon, we're asked fairly regularly about this. Will cover deploying into separate namespaces (easier) and the same namespace (harder, but still possible).

@skriss skriss removed the kind/feature Categorizes issue or PR as related to a new feature. label Nov 2, 2022
skriss added a commit to skriss/contour that referenced this issue Nov 2, 2022
skriss added a commit to skriss/contour that referenced this issue Nov 2, 2022
Closes projectcontour#855.

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit that referenced this issue Nov 3, 2022
Closes #855.

Signed-off-by: Steve Kriss <krisss@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deployment Issues or PRs related to deployment tooling or infrastructure. area/documentation Issues or PRs related to documentation. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.