<p>I have the following hello world deployment.</p>

<pre><code>---
apiVersion: extensions/v1beta1
kind: Deployment

metadata:
name: hello-deployment

spec:
replicas: 1

template:
    metadata:
    labels:
        app: hello
    spec:
    containers:
    - name: hello
        image: hello:v0.0.1
        imagePullPolicy: Always
        args:
        - /hello
        ports:
        - containerPort: 3000

---
apiVersion: v1
kind: Service

metadata:
name: hello-service

spec:
ports:
- port: 80
    targetPort: 3000
    protocol: TCP

selector:
    app: hello
type: NodePort
</code></pre>

<p>And I have ingress object deploy with side-car container</p>

<pre><code>---
apiVersion: extensions/v1beta1
kind: Deployment

metadata:
labels:
    app: alb-ingress-controller
name: alb-ingress-controller
namespace: kube-system

spec:
replicas: 1

selector:
    matchLabels:
    app: alb-ingress-controller

template:
    metadata:
    creationTimestamp: null
    labels:
        app: alb-ingress-controller
    spec:
    containers:
    - name: server
        image: alb-ingress-controller:v0.0.1
        imagePullPolicy: Always
        args:
        - /server
        - --ingress-class=alb
        - --cluster-name=AAA
        - --aws-max-retries=20
        - --healthz-port=10254

        ports:
        - containerPort: 10254
        protocol: TCP

    - name: alb-sidecar
        image: sidecar:v0.0.1
        imagePullPolicy: Always
        args:
        - /sidecar
        - --port=5000
        ports:
        - containerPort: 5000
        protocol: TCP

    dnsPolicy: ClusterFirst
    restartPolicy: Always
    securityContext: {}
    terminationGracePeriodSeconds: 30
    serviceAccountName: alb-ingress
    serviceAccount: alb-ingress

---
apiVersion: v1
kind: Service

metadata:
name: alb-ingress-controller-service

spec:
ports:
- port: 80
    targetPort: 5000
    protocol: TCP

selector:
    app: alb-ingress-controller
type: NodePort
</code></pre>

<p>And I have Ingress here</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress

metadata:
name: test-alb
annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80,"HTTPS": 443}]'
    alb.ingress.kubernetes.io/subnets: AAA
    alb.ingress.kubernetes.io/security-groups: AAA
labels:
    app: test-alb

spec:
rules:
- http:
    paths:
    - path: /hello
        backend:
        serviceName: hello-service
        servicePort: 80
    - path: /alb-sidecar
        backend:
        serviceName: alb-ingress-controller-service
        servicePort: 80
</code></pre>

<p>I would expect to access to <code>/alb-sidecar</code> the same way that I access to <code>/hello</code>, but only <code>/hello</code> endpoint works for me. And keep getting <code>502 Bad Gateway</code> for <code>/alb-sidecar</code> endpoint. The sidecar container is just a simple web app listening on <code>/alb-sidecar</code>.</p>

<p>Do I need do anything different when the sidecar container runs in a different namespace or how would you run a sidecar next to ALB ingress controller?</p>

enerudfwqenq
<p>If you created the deployment <code>alb-ingress-controller</code> and the service <code>alb-ingress-controller-service</code> in another namespace, you need to create another ingress resource in the exact namespace.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress

metadata:
name: test-alb
namespace: alb-namespace
annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80,"HTTPS": 443}]'
    alb.ingress.kubernetes.io/subnets: AAA
    alb.ingress.kubernetes.io/security-groups: AAA
labels:
    app: alb-service

spec:
rules:
- http:
    paths:
    - path: /alb-sidecar
        backend:
        serviceName: alb-ingress-controller-service
        servicePort: 80
</code></pre>
