1

I have a Minikube cluster running on an EC2 Instance. My goal is to run kubectl get pods on my locally running Windows machine to see the cluster info and etc. running on the Minikube cluster hosted on the said EC2 Instance.

So far, I have no successful attempts at doing this. Perhaps I could find my answers here, thanks in advance.

Extra context: I have done this & this too. Just not sure what else I could be missing or not understanding correctly.

Ankit Deshpande
  • 3,476
  • 1
  • 29
  • 42
Jkzs
  • 13
  • 2
  • Just to clarify you want to access k8s minikube single node cluster that is running on aws ec2 from your windows laptop. Right? – mchawre Sep 11 '19 at 06:20
  • Yes, correct. But not in the sense of `minikube ssh` or joining the cluster as a new node addition. – Jkzs Sep 11 '19 at 06:28
  • While following this https://www.systemcodegeeks.com/devops/remote-access-to-minikube-with-kubectl/ what error you got. Make sure the k8s api-server port should be accessible from your laptop. – mchawre Sep 11 '19 at 06:43
  • 2
    `Unable to connect to the server: x509: certificate is valid for 172.31.9.154, 10.96.0.1, 10.0.0.1, ` is the error I got following that guide. Could you elaborate more on "Make sure the k8s api-server port should be accessible from your laptop"? I have already made sure that 8443 has already been open on my AWS EC2 configuration and turn off/allowed on the IPTABLES/Firewall as well. – Jkzs Sep 11 '19 at 06:49
  • First of all you need to make sure the certificates you provided in the k8s config file are the correct one and also make sure the api server url is correct. You can confirm the k8s api server url by running `kubectl cluster-info` from within the minikube node. – mchawre Sep 11 '19 at 06:52
  • So when I am following [this guide](https://www.systemcodegeeks.com/devops/remote-access-to-minikube-with-kubectl/), once I have copied over the necessary files onto my Windows machine, I changed the `.kube/config` file server IP to the EC2 Instance's public IP instead as it was originally set to EC2 Instance's private IP(beginning with 172.XX.X.XXX). – Jkzs Sep 11 '19 at 07:04
  • I wouldn't be able to connect with the private IP anyways if I were to leave it as it was, it didn't work as well when I tried not changing it also. Which is also probably why I am getting `Unable to connect to the server: x509: certificate is valid for 172.31.9.154, 10.96.0.1, 10.0.0.1, ` when I change it to the public address. That's as far as I can understand. – Jkzs Sep 11 '19 at 07:04
  • Did you use nested virtualisation to run minikube on the ec2 instance, or you used the none driver? And secondly how have you forwarded traffic to the kubernetes api service, i.e. using a port forward, or some NAT rule, etc? – cewood Sep 11 '19 at 12:45
  • **Did you use nested virtualisation to run minikube on the ec2 instance** No, because I was running the EC2 Instance on AWS. No nested virtualization can be done or achieved in this case. **or you used the none driver?** Yes, I am using none driver. **And secondly how have you forwarded traffic to the kubernetes api service, i.e. using a port forward, or some NAT rule, etc?** Only opened port 8443 on AWS EC2 Instance network configuration and allowing it in the IPTABLES/Firewall within the server. – Jkzs Sep 12 '19 at 02:22

0 Answers0