Ambassador: Ambassador across namespaces

Created on 4 Feb 2018  路  4Comments  路  Source: datawire/ambassador

Just installed ambassador 0.23 over kuberenetes 1.9.2
TEsted it with an nginx container but it seems to work propertly only if the pob belong to the same namespace as ambassador.

Reading documentation it seems that acting across namespaces is related to AMBASSADOR_NAMESPACE value, but even forcing it to ambassador's own namespace ("default) nginx container is not exposed and I'm just getting a "no healthy upstream" error.

Am I missing something? given that ambassador is deployed into "default" namespace and nginx on "mynamespace" namespace which is the proper configuration? At the moment i'm setting

"env": [ { "name": "AMBASSADOR_NAMESPACE", "value": "default" } ]

into ambassador deployment (default was taking value from metadata.namespace which should be the same value, but i wanted to be 100% sure ).

Is anything similar expected also in nginx deployment as well?

docs

Most helpful comment

Thanks @polarn adding the namespace was the missing point.

Working perfectly on nginx on port 80, for other service on different port I had to add the port as well:

annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name:  consul_mapping
      prefix: /ui/
      rewrite: /ui/
      service: consul.mynamespace:8500

I think all these useful details should be added to documentation since AMBASSADOR_NAMESPACE configuration is not enough to have the cross-namestace feature to work ;)

All 4 comments

Try adding namespace to the service, i.e:

  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name:  nginx_mapping
      prefix: /nginx/
      service: nginx.default

Note the nginx.default, I have ambassador running in it's own namespace so I have to add .default to get it working for service in my default namespace.

Thanks @polarn adding the namespace was the missing point.

Working perfectly on nginx on port 80, for other service on different port I had to add the port as well:

annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name:  consul_mapping
      prefix: /ui/
      rewrite: /ui/
      service: consul.mynamespace:8500

I think all these useful details should be added to documentation since AMBASSADOR_NAMESPACE configuration is not enough to have the cross-namestace feature to work ;)

we previously updated the namespace documentation, and I fixed a few broken links that I discovered when verifying the fix.

Hi, on the same topic, may I know why this does not work for me? I have 2 namespaces test and test2. I deployed the following while I was in namespace test.

apiVersion: v1
kind: Service
metadata:
  name: qotm
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name:  qotm_mapping
      prefix: /qotm/
      service: qotm.test2
spec:
  selector:
    app: qotm
  ports:
  - port: 80
    name: http-qotm
    targetPort: http-api
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: qotm
  namespace: test2
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: qotm
    spec:
      containers:
      - name: qotm
        image: datawire/qotm:1.1
        ports:
        - name: http-api
          containerPort: 5000
        resources:
          limits:
            cpu: "0.1"
            memory: 100Mi

Deployment is explicitly deployed with namespace metadata. The ambassador config has also included the namespace in the service name.

I also checked AMBASSADOR_NAMESPACE was set correctly (i.e. test).

When I did curl, I got no healthy upstream.

ambassador version: 0.40.2
minikube version: v0.32.0
kubectl version

Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:39:04Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.4", GitCommit:"f49fa022dbe63faafd0da106ef7e05a29721d3f1", GitTreeState:"clean", BuildDate:"2018-12-14T06:59:37Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielmittelman picture danielmittelman  路  3Comments

vishal-yadav picture vishal-yadav  路  4Comments

cakuros picture cakuros  路  4Comments

Viacheslav-Akimov picture Viacheslav-Akimov  路  6Comments

pratikmallya picture pratikmallya  路  5Comments