<p>I'm trying to add a local Kubernates cluster to my GitLab group for CI/CD deployments. I've started with running the following command:</p>
<p><code>kubectl proxy --address 0.0.0.0 --accept-hosts '.*'</code></p>
<p>I've tested it executing <code>curl http://localhost:8001/api</code> and running <code>curl http://192.168.1.2:8001/api</code> from another machine in the same network. Proxy was available in my local network.</p>
<p>The next step was to make the proxy available on the internet behind <code>kubernates.example.com</code>. For that I've configured NGINX as the following:</p>
<pre><code>server {
    server_name kubernates.example.com;
    listen 443 ssl;
    listen 80;

    include ssl_standart_conf;

    location / {
        proxy_pass http://192.168.1.2:8001/;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection &quot;upgrade&quot;;
    }
}
</code></pre>
<p>Executing <code>curl https://kubernates.example.com/api</code> returned the following error:</p>
<pre><code>invalid upgrade response: status code 200
</code></pre>
<p>Kubernates proxy logs</p>
<pre><code>E0225 22:33:50.944018 1642369 upgradeaware.go:312] Proxy upgrade error: invalid upgrade response: status code 200
E0225 22:33:50.944060 1642369 proxy_server.go:144] Error while proxying request: invalid upgrade response: status code 200
</code></pre>

<p>Okay, I've managed to resolve the issue. The following nginx configuration made a trick</p>
<pre><code>server {
    server_name kubernates.example.com;
    listen 443 ssl;
    listen 80;

    include ssl_standart_conf;

    location / {
        proxy_pass http://192.168.1.2:8001/;
        proxy_set_header Host $host;
    }
}
</code></pre>
