Virtualbox running inside Linux Mint : issue with minikube credentials - kubernetes

On my laptop I have Linux Mint OS. Details as below:
Mint version 19,
Code name : Tara,
PackageBase : Ubuntu Bionic
Cinnamon (64-bit)
I have installed kubectl binary using curl from this reference site: https://kubernetes.io/docs/tasks/tools/install-kubectl/
commands used for kubectl installation:
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
installed minikube on local linux machine using the link:
https://github.com/kubernetes/minikube/releases
command used for minikube installation:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.29.0/minikube-linux-amd64 && chmod +x minikube && sudo cp minikube /usr/local/bin/ && rm minikube
Downloaded this VirtualBox 5.2.18 for Linux Ubuntu 18.04 / Debian 10 AMD64 from https://www.virtualbox.org/wiki/Downloads
THen I lanuched virtualbox manager. There is no virtual machine created.
Then followed quickstart guide on my local Linux Mint machine:
https://github.com/kubernetes/minikube/blob/v0.29.0/README.md
On my local Linux mint machine under downloads directory, the moment I run command "minikube start" :
xxxxxxxx:~/Downloads$ minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
171.87 MB / 171.87 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.0
Downloading kubelet v1.10.0
Finished Downloading kubelet v1.10.0
Finished Downloading kubeadm v1.10.0
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.
Though I am running minikue start command on my local Linux machine, it says its starting minikube in virtualmachine inside Oracle virtualbox manager.
My first question is HOW? Is there any specific setting that is being done behind the scenes to have minikube getting started in VM installed on my operating system (in this case I am on Linux mint 19)
minikube getting started in VM
If I double click on minikube running on VM, then it opens up a screen where it asks me logging to minikube. Please see below screenshot.
minikube asking credentials
My second question is: I haven't set any credentials for minikube. What could be the credentials? Is there any way to set credentials?
UPDATE 1
As per comment by #Rico , for his 2nd point, he said "to connect to minikube VM you can run minikube ssh" isn't it same like what I showed in 2nd attached screenshot in my issue? I mean double click on minikube VM running inside oracle virtualbox manager and that pops up screen asking for login credentials.
However, I tried to use command: minikube ssh on my local machine after starting minikube.
xxxxxxxxxxxxxx:~$ minikube ssh
_ _
_ _ ( ) ( )
___ ___ (_) ___ (_)| |/') _ _ | |_ __
/' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)
$ ls
$ pwd
/home/docker
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
k8s.gcr.io/coredns 1.2.2 367cdc8433a4 4 weeks ago 39.2MB
k8s.gcr.io/kubernetes-dashboard-amd64 v1.10.0 0dab2435c100 5 weeks ago 122MB
k8s.gcr.io/kube-apiserver-amd64 v1.10.0 af20925d51a3 6 months ago 225MB
k8s.gcr.io/kube-controller-manager-amd64 v1.10.0 ad86dbed1555 6 months ago 148MB
k8s.gcr.io/kube-scheduler-amd64 v1.10.0 704ba848e69a 6 months ago 50.4MB
k8s.gcr.io/etcd-amd64 3.1.12 52920ad46f5b 6 months ago 193MB
k8s.gcr.io/kube-addon-manager v8.6 9c16409588eb 7 months ago 78.4MB
k8s.gcr.io/k8s-dns-kube-dns-amd64 1.14.8 80cc5ea4b547 8 months ago 50.5MB
k8s.gcr.io/pause-amd64 3.1 da86e6ba6ca1 9 months ago 742kB
k8s.gcr.io/echoserver 1.4 a90209bb39e3 2 years ago 140MB
$
It didn't ask me any credentials.
So should I say that "Minikube uses boot2docker as its base image, so the default SSH login to the VM ends up being docker:tcuser"
UPDATE 2
As per #Rico: "basically when you do minikube ssh it connects to the VM using private/public key authentication" - I agree. It didn't ask me any credentials when I did "minikube ssh" command from my host machine.
also as per point 1: "with command 'minikube start' it starts the VM that has all the kubernetes components in it" - So for this I went ahead and tried to run any kubectl command after ssh ing into minikube and its saying command not found.
$ kubectle get pods
-bash: kubectle: command not found
However it does recognize docker command
$ docker --version
Docker version 17.12.1-ce, build 7390fc6
I also tried to find VM details
$ uname -a
Linux minikube 4.15.0 #1 SMP Thu Sep 27 17:28:06 UTC 2018 x86_64 GNU/Linux

The short answer, minkube downloads a VM image to your host machine, in this case, Mint Linux for you then it starts the VM that has all the kubernetes components in it.
Credentials can be from any user in the VM OS. To connect to the minikube VM you can run minikube ssh from your host. From there you can run something like sudo adduser to add any user you like and set the credentials that you'd like too.
Note: when you run minikube ssh you connect to the VM using ssh and it uses private/public key ssh authentication.

As a based image Minikube uses boot2docker, and default login details are docker:tcuser, you can also login using minikube ssh and tokens created by Minikube will be used to login without prompting for your login details.
You should first remove the old cluster minikube delete and create a new one minikube start.
You do not need to have VirtualBox installed as Minikube will stat it's own VM.
Of course, you can specify which VM driver should be used, using minikube start --vm-driver=virtualbox.
Please read the instructions provided on kubernetes.io regarding Minikube installation.

Thanks Shivraj and Rico for the posting questions and replies. They were badly needed.
To your problem Shivraj, please fire the kubectl commands on host machine.
I have also done a similar setup on my laptop with minikube creating a Linux VM for me. Docker images are running within the VM and kubectl is on the host machine.
I am following the link below; issuing kubectl commands on my host and is working perfectly fine.
Hope it helps.

Related

Minikube won't start on mac

Trying to start minikube on mac. Virtualization is being provided by VirtualBox.
$ minikube start
😄 minikube v1.1.0 on darwin (amd64)
🔥 Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
🐳 Configuring environment for Kubernetes v1.14.2 on Docker 18.09.6
❌ Unable to load cached images: loading cached images: loading image /Users/paul/.minikube/cache/images/k8s.gcr.io/kube-proxy_v1.14.2: Docker load /tmp/kube-proxy_v1.14.2: command failed: docker load -i /tmp/kube-proxy_v1.14.2
stdout:
stderr: open /var/lib/docker/image/overlay2/layerdb/tmp/write-set-542676317/diff: read-only file system
: Process exited with status 1
💣 Failed to setup certs: pre-copy: command failed: sudo rm -f /var/lib/minikube/certs/ca.crt
stdout:
stderr: rm: cannot remove '/var/lib/minikube/certs/ca.crt': Input/output error
: Process exited with status 1
😿 Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
👉 https://github.com/kubernetes/minikube/issues/new
Trying minikube delete followed by minikube start produces the same issue.
Docker is running and is signed in.
I also deleted all machines in virtualbox after minikube delete and still get the same result.
According to What if I answer a question in a comment? I am adding answer as well since many people dont read comments.
You can try to delete local config in MINIKUBE_HOME before starting minikube
rm -rf ~/.minikube
Try
minikube delete
and
minikube start

Error Starting Minikube on Ubuntu VM VirutalBox

I do have an Ubuntu VM in VirtualBox on Windows 10. If i follow the instructions to install Minikube I get a start error:
> minikube start &
[1] 4297
vagrant#ubuntu-xenial:~$ o minikube v0.35.0 on linux (amd64)
> Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
# Downloading Minikube ISO ...
184.42 MB / 184.42 MB [============================================] 100.00%
0s
! Unable to start VM: create: precreate: VBoxManage not found. Make sure
VirtualBox is installed and VBoxManage is in the path
Does it mean i need to install VirtualBox in the Ubuntu VM too? Kind of VB inside VB..
thanks
I'd recommend to install Minikube on your host OS (Windows) and use the already installed Virtual box as a hypervisor provider.
If for any reason you want to launch it on Ubuntu VM, there are two options:
I. Minikube supports a --vm-driver=none option that runs the Kubernetes components on the host and not in a VM. Using this driver requires Docker and a Linux environment, but not a hypervisor. In this case you have to provide an address to you local API server
`minikube start --vm-driver=none --apiserver-ips 127.0.0.1 --apiserver-name localhost`
And then go and edit ~/.kube/config, replacing the server IP that was
detected from the main network interface with "localhost". For example:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data:/home/asuh/.minikube/ca.crt
server: https://localhost:8443
name: minikube
II. Install VM Ware on Windows and run Ubuntu within installed Virtualbox
and and enabled VT-X/AMD-v in outer VM.
Regarding the error you have at the moment:
However now i get another error like: /usr/local/bin/minikube: cannot
execute binary file
Make sure you have installed a proper version of Minikube. For your Ubuntu VM it should be
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
&& chmod +x minikube
It is not recommended to use VM inside VM to run minikube. Check this answer. Try to run minikube with no vm drivers.
minikube start --vm-driver=none
I have read on minikube issues, but can not find it right now.
HTH

How to confirm minikube is using hyperkit

When trying to run minikube with hyperkit, I was getting errors about xhyve not being installed. I installed that and reran minikube start --vm-driver hyperkit with no issues.
I was under the impression that hyperkit was a replacement for xhyve, not a supplement to it.
When I run ps I see both com.docker.hyperkit and docker-machine-driver-xhyve running.
How can I confirm that minikube is correctly using hyperkit?
Docker for Mac changed virtualization layer few times last years, and it can confuse users after updates of environment.
If the process list shows both com.docker.hyperkit and xhyve processes is probably due
to docker-machine environment which was previously set up using docker-machine-driver-xhyve.
You may consider cleaning up installation by
stopping Docker (from command line or from tray icon),
next removing machines created by docker-machine tool.
I can also suggest to remove current minikube installation using
minikube stop && minikube delete
and start fresh one with:
minikube start --v=10 --vm-driver=hyperkit"
That will add additional verbose output of building minikube environment.
This will give you the current driver for the current machine. Replace the second "minikube" with the name of your profile if you're using the --profile flag.
$ cat ~/.minikube/machines/minikube/config.json | grep DriverName
Strange, considering Hyperkit is supposed to replace xhyve eventually.
Make sure Hyperkit is built/installed and referenced by tour PATH.
And that you are using the latest docker-ce for Mac.
Use this command to get a list of each hypervisor instance that's running with hyperkit:
$ ps -ef | grep hyperkit
If minikube is running in hyperkit then the name 'minikube' should show up in the output:
0 29305 1 0 Tue06PM ?? 515:01.32 /usr/local/bin/hyperkit -A -u -F /Users/me/.minikube/machines/minikube/hyperkit.pid -c 2 -m 2000M -s 0:0,...
The instance labeled as 'com.docker.hyperkit' is the process that's being used by Docker and is NOT the minikube instance.

Minikube installation on Debian 9

I've installed docker on Debian 9.3 and created a swarm using 4 computers.
Now I am trying to install Kubernetes locally and am having some trouble getting things to work.
$ uname -a
Linux tma 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3 (2017-12-03) x86_64 GNU/Linux
I'm trying to follow this guide:
https://kubernetes.io/docs/getting-started-guides/minikube/
I want to use Deb9 since that is what I use in our lab.
I am using KVM as the hypervisor.
Has anyone installed Kubernetes locally via Minikube successfully?
I get the following error: when I issue kubectl cluster-info as sudo and non-sudo
$kubectl cluster-info
Kubernetes master is running at localhost:8080 To further debug and diagnose cluster problems, use kubectl cluster-info dump. The connection to the server localhost:8080 was refused - did you specify the right host or port?
I have Minikube running on Debian.
I can reproduce your error if I don't have anything running. Most probably your cluster didn't start, you'll need to debug more.
This is a great Debian 9 + Minikube resource: https://medium.com/linagora-engineering/install-k8s-minikube-on-top-of-kvm-on-debian-9-9cd5b646063c

minikube start {OS type not recognized}

minikube start
giving below error messaage on Manjaro Deepin ( Arch Linux ).
E1002 00:02:24.832976 26272 start.go:143] Error starting host:
Temporary Error: Error configuring auth on host: OS type not
recognized.
tried it on VirtualBox with Ubuntu 16.04 and VT-X/AMD-v not enable error giving even Virtualbox preference set to VT-X/AMD-v enable.
Note : Need to fix the issue on my local machine not the virtualBox
uname -a output
Linux xxx-pc 4.9.51-1-MANJARO #1 SMP PREEMPT Wed Sep 20 10:37:40 UTC
2017 x86_64 GNU/Linux
If working on Linux, follow the steps:
Uninstall/delete all minikube related files
1. minikube delete
2. rm /usr/local/minikube
3. rm -rf ~/.minikube
Then do minikube start again. If it doesn't work uninstall & reinstall minikube.
For Windows user follow these steps:
Do minikube delete
Delete C:\Users\username\.minikube folder.
Do minikube start again.
Also, don't forget to stop all the process related to VirtualBox including VBoxHeadless before deleting minikube.
Please Enable VT-x on your computer's BIOS.
For Reference: https://kubernetes.io/docs/tasks/tools/install-minikube/