Remote Kubernetes API Access via MCP and kubectl

Forward Kubernetes API port and patch kubeconfig for remote cluster access

Updated: 5/18/2026
Difficulty
medium
Time
10m
Use Case
Access remote Kubernetes clusters running in VMs when direct API server connection is not available
Popularity
0 views

About this automation

iximiuz Labs' Kubernetes clusters run inside remote VMs, making direct kubectl or MCP server access impossible. Solution involves port forwarding and kubeconfig patching to enable remote API access.

How to implement

1

Identify remote Kubernetes API server address and port

2

Set up port forwarding from local machine to remote VM

3

Download kubeconfig from remote cluster

4

Patch kubeconfig with forwarded port address

5

Test kubectl connectivity to remote API server

6

Configure MCP server with patched kubeconfig