I have a Kubernetes cluster running on a VPC network with 1 master and 2 worker nodes, I want to access the Kubernetes dashboard on public IP. Can you help me, with how to do it? Both Master and worker nodes have public IPs attached to them. I want to expose to Kubernetes dashboard to the master public IP. I am able to access the dashboard locally without a VPN.
It is extremely bad practice and highly insecure to have a kubernetes cluster running on instances with public IPs.
Clusters should 100% be built in private subnets. You make use of ingress and the AWS support for ingress which provisions AWS load balancers to access applications in the cluster. I am of course assuming you are on AWS, however there are similar solutions for Azure and GCP.
Even then, the kubernetes dashboard is a very sensitive application and anyone gaining access to it can take complete control of your cluster, so it should never be served over a public IP. If you do need to get to it from the public internet, then deploy a bastion host in your cloud VPC with proper access controls and access it through the bastion.