microk8s icon indicating copy to clipboard operation
microk8s copied to clipboard

microk8s setup failed in M1

Open sincorchetes opened this issue 1 year ago • 13 comments

Summary

Darwin Alvaros-MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64

After installing microk8s on my system, I got this output message:

warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: The following errors occurred:
microk8s-vm: timed out waiting for response
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
An error occurred with the instance when trying to launch with 'multipass': returned exit code 2.
Ensure that 'multipass' is set up correctly and try again.

What Should Happen Instead?

Mmm... works?

Reproduction Steps

Setup microk8s from brew as documentation shows.

Introspection Report

sudo microk8s inspect
Password:
MicroK8s is not installed. Please run `microk8s install`.

Are you interested in contributing with a fix?

Yes

sincorchetes avatar Aug 16 '23 06:08 sincorchetes

I've turned up the vm from multipass and I got this when I choose open shell

launch failed: The following errors occurred:
primary: timed out waiting for response

Saving session...completed.
Deleting expired sessions...       7 completed.

[Process completed]

sincorchetes avatar Aug 16 '23 06:08 sincorchetes

Hi @sincorchetes

It looks like there is already a VM with the name microk8s-vm (perhaps from a previous installation?) and that's causing the installer to have a bad time. Can you try to see if force deleting the VM can unblock the install?

multipass delete microk8s-vm
multipass purge

microk8s install

neoaggelos avatar Aug 16 '23 08:08 neoaggelos

Hi @sincorchetes

It looks like there is already a VM with the name microk8s-vm (perhaps from a previous installation?) and that's causing the installer to have a bad time. Can you try to see if force deleting the VM can unblock the install?

multipass delete microk8s-vm
multipass purge

microk8s install

Hi @neoaggelos ,

$ microk8s uninstall
Thank you for using MicroK8s!

multipass delete microk8s-vm           
delete failed: The following errors occurred:
instance "microk8s-vm" does not exist

$ multipass purge                        
$ microk8s install --cpu 2 --mem 10 -y
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: The following errors occurred:
microk8s-vm: timed out waiting for response
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: instance "microk8s-vm" already exists
An error occurred with the instance when trying to launch with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.

sincorchetes avatar Aug 16 '23 10:08 sincorchetes

OK, I think I see what is happening.

The microk8s install command will eventually issue a command like multipass launch 22.04 --cpus 2 --mem 10G --name microk8s-vm. It appears that the launch command times out and the installer simply retries it a few times. However, the VM already exists and that's the error that you see.

See the relevant code in https://github.com/canonical/microk8s/blob/20ec6d5586dca71098ef2dd6a26ce1aecb1be499/installer/vm_providers/_multipass/_multipass.py#L67-L81

Can you please test whether you can launch a simple ubuntu VM with the following command?

multipass launch 22.04 --name test-vm --cpus 2 --mem 10G

Thanks!

neoaggelos avatar Aug 16 '23 12:08 neoaggelos

OK, I think I see what is happening.

The microk8s install command will eventually issue a command like multipass launch 22.04 --cpus 2 --mem 10G --name microk8s-vm. It appears that the launch command times out and the installer simply retries it a few times. However, the VM already exists and that's the error that you see.

See the relevant code in

https://github.com/canonical/microk8s/blob/20ec6d5586dca71098ef2dd6a26ce1aecb1be499/installer/vm_providers/_multipass/_multipass.py#L67-L81

Can you please test whether you can launch a simple ubuntu VM with the following command?

multipass launch 22.04 --name test-vm --cpus 2 --mem 10G

Thanks!

Hello,

I run this command but I got this output:

$ multipass launch 22.04 --name test-vm --cpus 2 --mem 10G

warning: "--mem" long option will be deprecated in favour of "--memory" in a future release. Please update any scripts, etc.
launch failed: The following errors occurred:
test-vm: timed out waiting for response

This command was launched after the run: microk8s uninstall multipass purge

sincorchetes avatar Aug 16 '23 12:08 sincorchetes

OK, looks like multipass is having issues with starting VMs. Can you share more details like multipass ls and multipass info test-vm to see what status the VM is in?

This looks like an issue with multipass rather than microk8s, could you create an issue in https://github.com/canonical/multipass with more information? Thank you

neoaggelos avatar Aug 17 '23 11:08 neoaggelos

Hi @neoaggelos ,

I got this:

multipass ls
Name                    State             IPv4             Image
test-vm             Unknown           --               Ubuntu 22.04 LTS

$ multipass info test-vm
Name:           test-vm
State:          Unknown
IPv4:           --
Release:        --
Image hash:     9c59c6097711 (Ubuntu 22.04 LTS)
CPU(s):         --
Load:           --
Disk usage:     --
Memory usage:   --
Mounts:         --

sincorchetes avatar Aug 18 '23 07:08 sincorchetes

Hi @sincorchetes

To me, this feels like multipass is having issues starting VMs on your machine. The reason for that is hard for me to understand. Can you please create an issue in https://github.com/canonical/multipass with this info and see if the multipass team can go into more details?

Thanks, I want to leave this issue open until we have figured out the cause.

neoaggelos avatar Aug 18 '23 14:08 neoaggelos

@neoaggelos , It's works following this guide: https://github.com/canonical/multipass/issues/3200#issuecomment-1687203485

sincorchetes avatar Aug 28 '23 09:08 sincorchetes

I am getting the same error while running microk8s install Trying to run microk8s on MacOS (macOS 13.5.1 / M1) Steps followed here - https://microk8s.io/docs/install-macos

asksmruti avatar Apr 15 '24 13:04 asksmruti

@neoaggelos , It's works following this guide: canonical/multipass#3200 (comment)

Did you provision the VM first with multipass and then setup microk8s on it ? Like the steps mentioned here - https://microk8s.io/docs/install-multipass

asksmruti avatar Apr 15 '24 13:04 asksmruti

Sorry, I've de-installed it and used a Linux environment to launch that because It's broken...

On Mon, Apr 15, 2024 at 3:19 PM asksmruti @.***> wrote:

@neoaggelos https://github.com/neoaggelos , It's works following this guide: canonical/multipass#3200 (comment) https://github.com/canonical/multipass/issues/3200#issuecomment-1687203485

Did you provision the VM first with multipass and then setup microk8s on it ? Like the steps mentioned here - https://microk8s.io/docs/install-multipass

— Reply to this email directly, view it on GitHub https://github.com/canonical/microk8s/issues/4154#issuecomment-2056837889, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHP5X25MNYICEW6IJRAHOH3Y5PHW5AVCNFSM6AAAAAA3SB34AOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJWHAZTOOBYHE . You are receiving this because you were mentioned.Message ID: @.***>

sincorchetes avatar Apr 15 '24 22:04 sincorchetes

I can echo everything said here. This was a completely fresh install, never run microk8s on this mac before. I get those errors. It seems that something is broken on your end. I'm using an M3 MBP.

craig-miller-radiant avatar Aug 27 '24 14:08 craig-miller-radiant