Getting error in installing minikube kubernates in Amazon Linux EC2

9/30/2019

I am trying to install kubernates using mikikube in Amazon-linux EC2 instance. I am following link as https://github.com/aws-samples/aws-workshop-for-kubernetes/blob/master/03-path-application-development/301-local-development/readme.adoc#setup-on-ec2-if-you-do-not-virtualbox-on-your-laptop for the same. Getting below error while executing

[ec2-user@ip-172-31-15-56 ~]$ minikube start --vm-driver=none
* minikube v1.4.0 on Amazon 2018.03
X The "none" driver requires root privileges. Please run minikube using 'sudo minikube --vm-driver=none'.
[ec2-user@ip-172-31-15-56 ~]$ sudo minikube start --vm-driver=none
sudo: minikube: command not found

Also have tried to follow all step under root user but error is same minikube: command not found.

Can anyone please help on this.

-- Baharul
amazon-ec2
kubernetes
minikube

2 Answers

9/30/2019

In user privileges:

[ec2-user@ip-172-31-15-56 ~]$which minikube
/path/to/minikube

then:

[ec2-user@ip-172-31-15-56 ~]$sudo /path/to/minikube --vm-driver=none
-- Thanh Nguyen Van
Source: StackOverflow

9/30/2019

First way is to use full path to minikube from regular user:

[ec2-user@ip-172-31-43-207 ~]$ whereis minikube 
minikube: /usr/local/bin/minikube

[ec2-user@ip-172-31-43-207 ~]$ sudo /usr/local/bin/minikube start --vm-driver=none
  minikube v1.4.0 on Amazon 2018.03 (xen/amd64)
  Running on localhost (CPUs=2, Memory=3945MB, Disk=7997MB) ...

Second way is to put your binary to root's default bin location:

[ec2-user@ip-172-31-43-207 ~]$ sudo cp /usr/local/bin/minikube /usr/bin/
[ec2-user@ip-172-31-43-207 ~]$ sudo minikube version
minikube version: v1.4.0
commit: 7969c25a98a018b94ea87d949350f3271e9d64b6
[ec2-user@ip-172-31-43-207 ~]$ sudo minikube start --vm-driver=none
  minikube v1.4.0 on Amazon 2018.03 (xen/amd64)
  Running on localhost (CPUs=2, Memory=3945MB, Disk=7997MB) ...

Regarding you docker issue in comments: ideally next time this should be separate question.

Yes, reproduced and received the same error as you.

This is the problem of "Amazon Linux AMI 2018.03" : Its clearly stated by @Vin Odh in Command not found: systemctl on Amazon Linux 2018.03 answer.

Amazon Linux AMI 2018.03 is an "Amazon Linux version 1" that does not come with systemd, so solution is simply use another distributive that works properly, for example I had no problems with

Ubuntu Server 16.04 LTS (HVM)


ubuntu@ip-172-31-40-246:~$ sudo minikube start --vm-driver=none
  minikube v1.4.0 on Ubuntu 16.04 (xen/amd64)
  Running on localhost (CPUs=2, Memory=3950MB, Disk=7876MB) ...
ℹ️   OS release is Ubuntu 16.04.6 LTS
  Preparing Kubernetes v1.16.0 on Docker 18.09.7 ...
  Downloading kubeadm v1.16.0
  Downloading kubelet v1.16.0
  Pulling images ...
  Launching Kubernetes ... 
  Configuring local host environment ...

⚠️  The 'none' driver provides limited isolation and may reduce system security and reliability.
⚠️  For more information, see:
  https://minikube.sigs.k8s.io/docs/reference/drivers/none/

⚠️  kubectl and minikube configuration will be stored in /home/ubuntu
⚠️  To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run:

    ▪ sudo mv /home/ubuntu/.kube /home/ubuntu/.minikube $HOME
    ▪ sudo chown -R $USER $HOME/.kube $HOME/.minikube

  This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
⌛  Waiting for: apiserver proxy etcd scheduler controller dns
  Done! kubectl is now configured to use "minikube"
-- VKR
Source: StackOverflow