Openshift route redirects to cluster console

8/20/2020

I'm installing OKD v3.11 cluster with ansible.

Cluster configuration:

  • 4 master-infra-etcd nodes
  • 4 computing nodes
  • 1 external load balancer

Load balancer configuration is described here: https://github.com/redhat-cop/openshift-playbooks/blob/master/playbooks/installation/load_balancing.adoc#custom-certificate-ssl-termination-production

I'm using nginx as my external load balancer.

Inventory (truncated):

openshift_master_cluster_hostname: okd-internal.example.com
openshift_master_cluster_public_hostname: okd.example.com
openshift_master_default_subdomain: okd.example.com

Here is my NGINX configuration:

user  nginx;

error_log  /var/log/nginx/error.log warn;
load_module /usr/lib64/nginx/modules/ngx_stream_module.so;
pid        /var/run/nginx.pid;

worker_processes  "4";

events {
    worker_connections  1024;
    multi_accept off;
}

stream {
    upstream okd_masters {
      server okdmaster01.lab.example.com:8443;
      server okdmaster02.lab.example.com:8443;
      server okdmaster03.lab.example.com:8443;
      server okdmaster04.lab.example.com:8443;
    }
    server {
        listen 8443;
        proxy_pass okd_masters;
    }
}

http {

    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    server_names_hash_bucket_size 64;

    client_max_body_size 20M;

    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;

    keepalive_timeout  120;
    keepalive_requests 10;

    server_tokens on;


    upstream okd_masters {
      server okdmaster01.lab.example.com:8443;
      server okdmaster02.lab.example.com:8443;
      server okdmaster03.lab.example.com:8443;
      server okdmaster04.lab.example.com:8443;
    }

    server {
      listen      443 ssl;
      server_name okd.example.com *.okd.example.com;

      ssl_certificate           /etc/nginx/ssl/all.okd.example.com.crt;
      ssl_certificate_key       /etc/nginx/ssl/all.okd.example.com.key;

      ssl_session_cache         shared:SSL:10m;
      ssl_session_timeout       5m;
      ssl_protocols             TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers               ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5;
      ssl_prefer_server_ciphers on;

      proxy_connect_timeout 600;
      proxy_send_timeout 600;
      proxy_read_timeout 600;
      send_timeout 600;
      keepalive_timeout 600;
      keepalive_requests 10;

      proxy_set_header X-Forwarded-Host $host:$server_port;
      proxy_set_header X-Forwarded-Server $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

      proxy_buffering off;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      proxy_set_header Host      $host;

      location / {
        proxy_pass https://okd_masters;
      }
    }
  }

The problem is when I'm trying to access route (app.okd.example.com) I'm getting redirected to okd.example.com instead

-- Nick Foster
kubernetes
okd
openshift
redhat

0 Answers