title: Failed to connect to port 8080: Connection timed out
body: <p>I'm trying to deploy <a href="https://github.com/buchgr/bazel-remote" rel="nofollow noreferrer">bazel-remote</a>, but when I try to:</p>
  <pre><code>curl http://bazel-remote.dev.azr.myhost.com:80/status
  </code></pre>
  <p>into the ingress host, I'm getting:</p>
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;title&gt;308 Permanent Redirect&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;center&gt;&lt;h1&gt;308 Permanent Redirect&lt;/h1&gt;&lt;/center&gt;
  &lt;hr&gt;&lt;center&gt;nginx&lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>
  <p>back. For reference, I've tried:</p>
  <pre><code>curl http://bazel-remote.dev.azr.myhost.com:8080/status
  </code></pre>
  <p>but it gave the same results as when I specified the port number as any arbitrary port, and timed out.</p>
  <p>I checked the status of each of the pods, services, ingresses on lens, and they all seem to be running fine. Similar story for the volumes. I've deployed them through Terraform, and they all seem to be operating fine.</p>
  <p><strong>Strange things I don't get:</strong></p>
  <ul>
  <li>The pods enter <code>CrashLoop</code> when I try specify <code>BAZEL_REMOTE_HOST</code> in the ConfigMap. Most likely due to <a href="https://github.com/buchgr/bazel-remote/blob/a8117a609eff959d725c45a4632a7027445df65d/BUILD.bazel#L80-L82" rel="nofollow noreferrer">this</a>.</li>
  <li><code>http://bazel-remote.dev.azr.myhost.com:8080/metrics</code> is accessible via my web browser, detailing the bazel-remote caching capabilities.</li>
  <li>When I specified in <code>.bazelrc</code> : <code>build --remote_cache=http://bazel-remote.dev.azr.myhost.com:8080</code>, it didn't work, but when I took the pod IP addresses directly, and put that instead, the remote caching worked as intended.</li>
  </ul>
  <p><strong>Suspects:</strong>
  I suspect there is something wrong with my ingress, since the pods are definitely up, and functioning if I target them directly.</p>
  <p><strong>Ingress:</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>---
  apiVersion: networking.k8s.io/v1beta1
  kind: Ingress
  metadata:
    namespace: infra--bazel-remote-cache
    name: bazel-remote-cache
    annotations:
      kubernetes.io/ingress.class: nginx-internal
      nginx.ingress.kubernetes.io/rewrite-target: /$1
      nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
      cert-manager.io/cluster-issuer: selfsigned-cluster-issuer
  spec:
    tls:
    - hosts:
      - bazel-remote.dev.azr.myhost.com
      secretName: tls-secret
    rules:
    - host: bazel-remote.dev.azr.myhost.com:
      http:
        paths:
        - backend:
            serviceName: bazel-remote-service
            servicePort: 8080
          path: /(.*)
  
  
  
  </code></pre>
  <p><strong>Configmap</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
  kind: ConfigMap
  metadata:
    name: bazel-remote-cache-config
    namespace: infra--bazel-remote-cache
  data:
    BAZEL_REMOTE_DIR: /mnt/bazel_remote_backend
    BAZEL_REMOTE_MAX_SIZE: &quot;10&quot;
    BAZEL_REMOTE_GRPC_PORT: &quot;9092&quot;
    BAZEL_REMOTE_PORT: &quot;8080&quot;
    BAZEL_REMOTE_ENABLE_ENDPOINT_METRICS: &quot;true&quot;
    BAZEL_REMOTE_EXPERIMENTAL_REMOTE_ASSET_API: &quot;true&quot;
  
  </code></pre>
  <p><strong>Deployment &amp; Service</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: bazel-remote-cache
    namespace: infra--bazel-remote-cache
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: bazel-remote-cache
    template:
      metadata:
        labels:
          app: bazel-remote-cache
      spec:
        containers:
        - name: bazel-remote-cache
          image: buchgr/bazel-remote-cache:v2.1.1
          resources:
            limits:
              memory: 256Mi
              cpu: &quot;200m&quot;
            requests:
              memory: 256Mi
              cpu: &quot;200m&quot;
          volumeMounts:
          - mountPath: &quot;/mnt/bazel_remote_backend&quot;
            name: bazel-remote-cache
          ports:
          - containerPort: 8080
            protocol: TCP
          envFrom:
          - configMapRef:
              name: bazel-remote-cache-config
        volumes:
        - name: bazel-remote-cache
          persistentVolumeClaim:
            claimName: pvc-bazel-remote
  
  ---
  apiVersion: v1
  kind: Service
  metadata:
    name: bazel-remote-service
    namespace: infra--bazel-remote-cache
  spec:
    type: ClusterIP
    ports:
    - name: http
      port: 8080
      protocol: TCP
      targetPort: 8080
    selector:
      app: bazel-remote-cache
  
  </code></pre>