<p>The default Kubernetes (K3S) installation (rather rudely) occupies port 443 with the metrics-server. I am able to patch the service to change the port but then kubectl does not know how to query metrics. Where do I change the port for the kubectl client?
Port 443 is not not in <code>~./kube/config</code> (only 6443 - the api port).</p>
<pre class="lang-sh prettyprint-override"><code>$ kubectl get --raw &quot;/apis/metrics.k8s.io/v1beta1/nodes&quot;
{&quot;kind&quot;:&quot;NodeMetricsList&quot;,&quot;apiVersion&quot;:&quot;metrics.k8s.io/v1beta1&quot;,...
</code></pre>
<pre class="lang-sh prettyprint-override"><code>$ kubectl patch service metrics-server -n kube-system --type='json' --patch='[{&quot;op&quot;: &quot;replace&quot;, &quot;path&quot;: &quot;/spec/ports/0/port&quot;, &quot;value&quot;:7443}]'
service/metrics-server patched
$ kubectl get --raw &quot;/apis/metrics.k8s.io/v1beta1/nodes&quot;
Error from server (ServiceUnavailable): the server is currently unable to handle the request
</code></pre>

Marc
<p>metrics-server has registered 443 with api-server during installation. Easiest way is <a href="https://rancher.com/docs/k3s/latest/en/installation/install-options/server-config/#kubernetes-components" rel="nofollow noreferrer">disable</a> the bundled metrics-server and re-install with the service port set to 7443 <a href="https://github.com/kubernetes-sigs/metrics-server/blob/4b20c2d43e338d5df7fb530dc960e5d0753f7ab1/charts/metrics-server/values.yaml#L104" rel="nofollow noreferrer">here</a>, so the call out would reach the right port. If you are using the manifest, amend the port number <a href="https://github.com/kubernetes-sigs/metrics-server/blob/4b20c2d43e338d5df7fb530dc960e5d0753f7ab1/manifests/base/service.yaml#L10" rel="nofollow noreferrer">here</a>.</p>
