I have a 3 kubernetes cluster on 3 ubuntu VM with 1 master and 2 worker and using kubectl utility on master to manage this,I want to connect to this cluster from comamnd line utility kubectl from my laptop using kubeconfig authentication file, but unable

Amit Kumar 20 Reputation points
2023-02-27T17:21:15.1+00:00

I have a 3 kubernetes cluster on 3 ubuntu VM with 1 master and 2 worker and using kubectl utility on master to manage this,I want to connect to this

cluster from comamnd line utility kubectl from my laptop using kubeconfig authentication file, but unable to do so as controlplace use the private IP to

run the kube-API server on 6443 port by default. Do we have any mechanism to connect my cluster from my laptop command from and not from master node itself. Pls help

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,456 questions
{count} votes

Accepted answer
  1. Daran Tallarida 75 Reputation points Microsoft Employee
    2023-02-27T18:56:04.8333333+00:00

    I am making some assumptions here based on what you've provided and asked.

    Are you connected to a jumpbox vm where you are then trying to connect to the cluster to administer?

    if so, run this to authenticate with the cluster:

    az aks get-credentials --resource-group yourRG --name yourCluster

    If you have a private cluster then you'll need to tunnel into the VM and then jump to the cluster where you would then authenticae with az aks get-credentials command.

    Because I am unsure of your setup, then possibly you could review the following to see if it's helpful on how to setup your jumpbox to access your cluster.

    https://techcommunity.microsoft.com/t5/core-infrastructure-and-security/private-aks-and-acr-using-private-endpoint-part-1-2/ba-p/3088721

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Amit Kumar 20 Reputation points
    2023-02-27T19:38:45.9866667+00:00

    Hi Daran,

    I will try to explain again, This is not an AKS cluster, I have taken 3 ubuntu VM on azure and configure kubernetes manually with the help of kubeadm init and kubeadm join command after installing the required packages/software. All 3 VM's has private and public IP allocated. I am able to manage this K8s cluster after login to my master which is the first node out of 3 with the public IP, out of 3, 1 is master and 2 are worker node.

    problem starts here, kube-api server is configured on private IP of master:6443 and not on public. Requirement is- I want to connect my master with windows laptop cmd and want to manage my cluster with kubectl utility on my laptop but I am unable to connect because API has used the private IP of VM.

    Is there any way to solve this connectivity Issue.

    Thanks,

    Amit

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.