Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem to execute microk8s CLI MacOs BigSur 11.4 #2396

Closed
olympien13 opened this issue Jul 1, 2021 · 13 comments
Closed

Problem to execute microk8s CLI MacOs BigSur 11.4 #2396

olympien13 opened this issue Jul 1, 2021 · 13 comments
Assignees
Labels

Comments

@olympien13
Copy link

I have a Mac with BigSur v11.4 installed I followed the instructions to install MicroK8s on top of it.
https://microk8s.io/docs/install-alternatives#heading--macos

The installation went successfully without any errors.
"microk8s install" installed perfectly too and I run it again I got that output:
microk8s install
MicroK8s is up and running. See the available commands with microk8s --help

However I can not execute any of others CLI commands"microk8s" commands such as "status", "stop",
microk8s status
sudo: microk8s.status: command not found
An error occurred when trying to execute 'sudo microk8s.status' with 'multipass': returned exit code 1.

microk8s stop
sudo: microk8s.stop: command not found
An error occurred when trying to execute 'sudo microk8s.stop' with 'multipass': returned exit code 1.

Any Clue ? Any idea ? Any suggestions that could help me ?

@ktsakalozos
Copy link
Member

On MacOs K8s runs in a VM that is driven by Multipass [1]. Could you check if Multipass is ok and that there is a MicroK8s VM running?

[1] https://multipass.run/

@olympien13
Copy link
Author

Hi,

Multipass is also installed successfull and the VM is running fine as you can see:
multipass list
Name State IPv4 Image
microk8s-vm Running 192.168.64.9 Ubuntu 18.04 LTS

@ktsakalozos
Copy link
Member

If you get into the VM with multipass shell microk8s-vm do the microk8s commands work? For example how does your microk8s status and microk8s kubectl get all -A look like? If they do not can you fetch a microk8s.inspect tarball (with the help of multipass transfer) and attach it to this issue?

@olympien13
Copy link
Author

Hi,
Here are the output of the two commands you asked me to enter into the multipass VM:
ubuntu@microk8s-vm:/$ microk8s status
microk8s: command not found
ubuntu@microk8s-vm:/$ microk8s kubectl get all -A
microk8s: command not found

Indeed as if it was not installed into the VM.

Regarding the microk8s.inspect how I can invoke it ?
Here is the output the "microk8s inspect" on my mac:
microk8s inspect
sudo: microk8s.inspect: command not found
An error occurred when trying to execute 'sudo microk8s.inspect' with 'multipass': returned exit code 1.

Into the VM here is the output:
ubuntu@microk8s-vm:~$ microk8s inspect
microk8s: command not found

@ktsakalozos
Copy link
Member

Could it be /snap is not in the PATH? How does ls /snap and snap list look like? It is strange that the VM got created but the snap is not installed. @joedborg have you seen this before?

@olympien13
Copy link
Author

I was able to find out indeed that I had to execute manually the command into Multipass VM:
sudo snap install microk8s --classic --channel=1.18/stable

in order to make it work.

Not sure this is normal I had to run it manually as it is not clearly stated according to me in the doc :
https://microk8s.io/docs/install-alternatives#heading--macos

@olympien13
Copy link
Author

I still have a small issue. Indeed while executing the "microk8s kubectl" CLI commands into the Multipass VM it works fine. However when trying to invoke them from my Mac, I got:

microk8s kubectl get pods --all-namespaces
error: stat /Users/Livigni/.microk8s/config: no such file or directory

microk8s kubectl get nodes
error: stat /Users/Livigni/.microk8s/config: no such file or directory

I guess one configuration step is also missing but don't know which ?

@ktsakalozos
Copy link
Member

ktsakalozos commented Jul 2, 2021

You can get the kubeconfig file by running microk8s config.

@olympien13
Copy link
Author

Great. I had to create by hand the directory ".microk8s" and the content of the microk8s config command within a file named config.
Works now from my Mac as expected.
@ktsakalozos Thanks a lot for your help and support

@rkazak
Copy link

rkazak commented Apr 12, 2022

I just installed microk8s on my mbp

 % sw_vers
ProductName:	macOS
ProductVersion:	12.3.1
BuildVersion:	21E258

And still see that the directory ~/.microk8s was not created automatically? The workaround above worked for me too.

  1. Manually create the directory ( mkdir ~/.microk8s )
  2. Grab the config from the VM environment directly ( multipass shell microk8s-vm, microk8s config )
  3. create a file ~/.microk8s/config with the contents from point (2)

@gsuda2001
Copy link

I was able to find out indeed that I had to execute manually the command into Multipass VM: sudo snap install microk8s --classic --channel=1.18/stable

in order to make it work.

Not sure this is normal I had to run it manually as it is not clearly stated according to me in the doc : https://microk8s.io/docs/install-alternatives#heading--macos

Same issue for me as well in my Macbook.Post this snap installation getting microk8s working.

@shitalm
Copy link

shitalm commented Dec 15, 2022

After Mac upgrade (Mac Monteray, 12.6.1), I got following error:
microk8s start

start failed: The following errors occurred:
Instance stopped while starting
An error occurred when trying to execute 'sudo microk8s.start' with 'multipass': returned exit code 2.

Somehow my VM failed to start and was stuck, executed multipass list to find the status of VM:
multipass list

Name State IPv4 Image
microk8s-vm Starting -- Ubuntu 18.04 LTS

I then executed following command to recover:

multipass stop microk8s-vm
multipass delete microk8s-vm
multipass purge

and then finally reinstalled microk8s:
microk8s install

This finally fixed the issue.

Copy link

stale bot commented Nov 10, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants