microk8s: Error trying to enable community on MicroK8s v1.27.2

Summary

Error trying to enable community on MicroK8s v1.27.2

I have some VMs on DigitalOcean, and I’ve installed MicroK8s v1.27.2 revision 5372. When I try to run microk8s enable community I get an error: microk8s community ModuleNotFoundError: No module named 'importlib_resources'

What Should Happen Instead?

The community addon should enable, so I can then use community addons.

Reproduction Steps

Consistently reproducible.

  1. Set up 3 VMs on Digital Ocean
  2. Install MicroK8s
  3. Try to enable community: microk8s enable community

This is what shows:

Infer repository core for addon community
Traceback (most recent call last):
  File "/snap/microk8s/5372/scripts/wrappers/addons.py", line 11, in <module>
    import jsonschema
  File "/usr/lib/python3/dist-packages/jsonschema/__init__.py", line 12, in <module>
    from jsonschema._format import (
  File "/usr/lib/python3/dist-packages/jsonschema/_format.py", line 10, in <module>
    from jsonschema.exceptions import FormatError
  File "/usr/lib/python3/dist-packages/jsonschema/exceptions.py", line 13, in <module>
    from jsonschema import _utils
  File "/usr/lib/python3/dist-packages/jsonschema/_utils.py", line 12, in <module>
    import importlib_resources as resources  # type: ignore
ModuleNotFoundError: No module named 'importlib_resources'

Note that, if I use MicroK8s 1.26, I don’t have a problem - community enables fine.

Introspection Report

inspection-report-20230622_113152.tar.gz

Can you suggest a fix?

no

Are you interested in contributing with a fix?

no

Here is full detail:

# microk8s version
MicroK8s v1.27.2 revision 5372

# microk8s status
microk8s is running
high-availability: yes
  datastore master nodes: 170.64.164.121:19001 170.64.165.146:19001 170.64.165.136:19001
  datastore standby nodes: none
addons:
  enabled:
    dns                  # (core) CoreDNS
    ha-cluster           # (core) Configure high availability on the current node
    helm                 # (core) Helm - the package manager for Kubernetes
    helm3                # (core) Helm 3 - the package manager for Kubernetes
    rbac                 # (core) Role-Based Access Control for authorisation
  disabled:
    cert-manager         # (core) Cloud native certificate management
    community            # (core) The community addons repository
    dashboard            # (core) The Kubernetes dashboard
    gpu                  # (core) Automatic enablement of Nvidia CUDA
    host-access          # (core) Allow Pods connecting to Host services smoothly
    hostpath-storage     # (core) Storage class; allocates storage from host directory
    ingress              # (core) Ingress controller for external access
    kube-ovn             # (core) An advanced network fabric for Kubernetes
    mayastor             # (core) OpenEBS MayaStor
    metallb              # (core) Loadbalancer for your Kubernetes cluster
    metrics-server       # (core) K8s Metrics Server for API access to service metrics
    minio                # (core) MinIO object storage
    observability        # (core) A lightweight observability stack for logs, traces and metrics
    prometheus           # (core) Prometheus operator for monitoring and logging
    registry             # (core) Private image registry exposed on localhost:32000
    storage              # (core) Alias to hostpath-storage add-on, deprecated

# microk8s enable community
Infer repository core for addon community
Traceback (most recent call last):
  File "/snap/microk8s/5372/scripts/wrappers/addons.py", line 11, in <module>
    import jsonschema
  File "/usr/lib/python3/dist-packages/jsonschema/__init__.py", line 12, in <module>
    from jsonschema._format import (
  File "/usr/lib/python3/dist-packages/jsonschema/_format.py", line 10, in <module>
    from jsonschema.exceptions import FormatError
  File "/usr/lib/python3/dist-packages/jsonschema/exceptions.py", line 13, in <module>
    from jsonschema import _utils
  File "/usr/lib/python3/dist-packages/jsonschema/_utils.py", line 12, in <module>
    import importlib_resources as resources  # type: ignore
ModuleNotFoundError: No module named 'importlib_resources'

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Hi @angelcervera @jamest-portainer the fix has been backported to 1.27 tracks now, and it is available on the 1.27/edge channel, i.e.

sudo snap refresh microk8s --channel 1.27/edge

And it is currently in progress to be pushed to 1.27/stable (should land in a couple of days)

Hi @neoaggelos, yes, I tried your build and it works.

As follows…

root@ubuntu:~# snap install microk8s --classic
Download snap "microk8s" (5372) from channel "1.27/stable"
[etc.]
Run configure hook of "microk8s" snap if present
[etc.]
microk8s (1.27/stable) v1.27.2 from Canonical✓ installed

root@ubuntu:~# microk8s enable community
Infer repository core for addon community
Traceback (most recent call last):
  File "/snap/microk8s/5372/scripts/wrappers/addons.py", line 11, in <module>
    import jsonschema
  File "/usr/lib/python3/dist-packages/jsonschema/__init__.py", line 12, in <module>
    from jsonschema._format import (
  File "/usr/lib/python3/dist-packages/jsonschema/_format.py", line 10, in <module>
    from jsonschema.exceptions import FormatError
  File "/usr/lib/python3/dist-packages/jsonschema/exceptions.py", line 13, in <module>
    from jsonschema import _utils
  File "/usr/lib/python3/dist-packages/jsonschema/_utils.py", line 12, in <module>
    import importlib_resources as resources  # type: ignore
ModuleNotFoundError: No module named 'importlib_resources'

root@ubuntu:~# snap refresh microk8s --channel latest/edge/python-path
microk8s (edge/python-path) v1.27.3 from Canonical✓ refreshed

root@ubuntu:~# microk8s enable community
Infer repository core for addon community
Cloning into '/var/snap/microk8s/common/addons/community'...
done.
Community repository is now enabled

Thank you!