canonical / microk8s

MicroK8s is a small, fast, single-package Kubernetes for datacenters and the edge.
https://microk8s.io
Apache License 2.0
8.37k stars 765 forks source link

Error enabling community addon in MicroK8s 1.30.1 #4574

Open JosePedro90 opened 1 month ago

JosePedro90 commented 1 month ago

Summary

I encountered an error when trying to enable the community addon in MicroK8s version 1.30.1. The error message suggests an issue with repository ownership and permissions. This issue did not occur in MicroK8s version 1.29, where the same command worked fine.

What Should Happen Instead?

The community addon should be enabled without any errors, as it did in version 1.29.

Reproduction Steps

  1. Install MicroK8s version 1.30.1
  2. Run the command microk8s enable community

Error Log

Infer repository core for addon community
Cloning into '/var/snap/microk8s/common/addons/community'...
fatal: detected dubious ownership in repository at '/snap/microk8s/current/addons/community/.git'
To add an exception for this directory, call:

git config --global --add safe.directory /snap/microk8s/current/addons/community/.git

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Traceback (most recent call last):
File "/snap/microk8s/6876/scripts/wrappers/addons.py", line 351, in <module>
addons(prog_name="microk8s addons")
File "/snap/microk8s/6876/usr/lib/python3/dist-packages/click/core.py", line 764, in **call**
return self.main(*args, **kwargs)
File "/snap/microk8s/6876/usr/lib/python3/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/snap/microk8s/6876/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/snap/microk8s/6876/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/snap/microk8s/6876/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/microk8s/6876/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/snap/microk8s/6876/scripts/wrappers/addons.py", line 207, in add
subprocess.check_call(cmd)
File "/snap/microk8s/6876/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/snap/microk8s/6876/git.wrapper', 'clone', '/snap/microk8s/current/addons/community', PosixPath('/var/snap/microk8s/common/addons/community')]' returned non-zero exit status 128.

Thank you 😊

ktsakalozos commented 1 month ago

Thank you for reporting this @JosePedro90 . While we are working on a fix, can you try sudo microk8s enable community ?

JosePedro90 commented 1 month ago

I tried using sudo and the issue remained

tdeckers commented 1 month ago

Got the same error. Running the suggested command fixes the problem:

git config --global --add safe.directory /snap/microk8s/current/addons/community/.git
mutekinootoko commented 2 weeks ago

Got the same error. Running the suggested command fixes the problem:

git config --global --add safe.directory /snap/microk8s/current/addons/community/.git

works for me