Score:0

juju k8s-core deployment: Waiting for CNI plugins to become available

td flag

I am struggling with installation of juju kubernetes-core charm

I have setup three environments:

  • juju-controller
  • juju add-cloud manual
  • added two focal Ubuntu 4 CPU 4GB RAM

Then I ran:

juju deploy --dry-run cs:bundle/kubernetes-core-1340 --map-machines=existing,0=0,1=1

and see that I am stuck in "juju status"

Model    Controller  Cloud/Region      Version  SLA          Timestamp
default  k8s         k8scloud/default  2.9.10   unsupported  13:08:03+02:00

App                Version         Status   Scale  Charm              Store       Channel   Rev  OS      Message
containerd         go1.13.8        active       2  containerd         charmstore  edge      147  ubuntu  Container runtime available
easyrsa            3.0.1           active       1  easyrsa            charmstore  edge      396  ubuntu  Certificate Authority connected.
etcd               3.4.5           active       1  etcd               charmstore  edge      608  ubuntu  Healthy with 1 known peer
flannel                            error        2  flannel            charmstore  edge      572  ubuntu  hook failed: "install"
kubernetes-master  1.22.0-alpha.2  waiting      1  kubernetes-master  charmstore  edge     1035  ubuntu  Waiting for CNI plugins to become available
kubernetes-worker  1.22.0-alpha.2  waiting      1  kubernetes-worker  charmstore  edge      789  ubuntu  Waiting for cluster credentials.

Unit                  Workload  Agent  Machine  Public address  Ports     Message
easyrsa/0*            active    idle   0/lxd/0  10.156.136.137            Certificate Authority connected.
etcd/0*               active    idle   0        172.16.51.212   2379/tcp  Healthy with 1 known peer
kubernetes-master/0*  waiting   idle   0        172.16.51.212             **Waiting for CNI plugins to become available**
  containerd/1        active    idle            172.16.51.212             Container runtime available
  flannel/1           error     idle            172.16.51.212             hook failed: "install"
kubernetes-worker/0*  waiting   idle   1        172.16.51.213             Waiting for cluster credentials.
  containerd/0*       active    idle            172.16.51.213             Container runtime available
  flannel/0*          error     idle            172.16.51.213             hook failed: "install"

Machine  State    DNS             Inst id               Series  AZ  Message
0        started  172.16.51.212   manual:172.16.51.212  focal       Manually provisioned machine
0/lxd/0  started  10.156.136.137  juju-c9d9ed-0-lxd-0   focal       Container started
1        started  172.16.51.213   manual:172.16.51.213  focal       Manually provisioned machine

When I open flannel log I see:

2021-08-06 10:29:20 ERROR unit.flannel/0.juju-log server.go:314 Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/charms/reactive/__init__.py", line 71, in main
    bus.discover()
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 426, in discover
    _register_handlers_from_file(search_path, filepath)
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 466, in _register_handlers_from_file
    _load_module(root, filepath)
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 444, in _load_module
    return importlib.import_module(package + module)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
...skipping...
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/var/lib/juju/agents/unit-flannel-0/charm/hooks/relations/kubernetes-cni/provides.py", line 5, in <module>
    from charms.layer.kubernetes_common import kubeclientconfig_path
**ModuleNotFoundError: No module named 'charms.layer.kubernetes_common'**

2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60 Traceback (most recent call last):
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "/var/lib/juju/agents/unit-flannel-0/charm/hooks/install", line 22, in <module>
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60     main()
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/charms/reactive/__init__.py", line 71, in main
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60     bus.discover()
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 426, in discover
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60     _register_handlers_from_file(search_path, filepath)
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 466, in _register_handlers_from_file   
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60     _load_module(root, filepath)
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 444, in _load_module
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60     return importlib.import_module(package + module)
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60     return _bootstrap._gcd_import(name[level:], package, level)
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "<frozen importlib._bootstrap_external>", line 848, in exec_module
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60   File "/var/lib/juju/agents/unit-flannel-0/charm/hooks/relations/kubernetes-cni/provides.py", line 5, in <module>
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60     from charms.layer.kubernetes_common import kubeclientconfig_path
2021-08-06 10:54:52 WARNING unit.flannel/0.install logger.go:60 ModuleNotFoundError: No module named 'charms.layer.kubernetes_common'
2021-08-06 10:54:52 ERROR juju.worker.uniter.operation runhook.go:139 hook "install" (via explicit, bespoke hook script) failed: exit status 1
2021-08-06 10:54:52 INFO juju.worker.uniter resolver.go:144 awaiting error resolution for "install" hook
2021-08-06 10:59:52 INFO juju.worker.uniter resolver.go:144 awaiting error resolution for "install" hook
2021-08-06 10:59:52 INFO unit.flannel/0.juju-log server.go:314 Reactive main running for hook install
2021-08-06 10:59:52 ERROR unit.flannel/0.juju-log server.go:314 Hook error:

I am not sure why the module can not be installed or is missing.

Score:0
cn flag

I'm not a k8s expert but seems that's a bug reported in: https://bugs.launchpad.net/charm-flannel/+bug/1938943

Seem's you are using Flannel charm and it's missing the kubernetes_common layer.

As they said in the Launchpad Calico has the kubernetes_common layer can you switch to Calico charm if you don't specifically need the Flannel as a workaround?

Detailed information: https://ubuntu.com/kubernetes/docs/charm-calico

Edit: Alternatively you can add layer:kubernetes-common to layer.yaml and build the charm :)

Viktorbs avatar
td flag
thank you very much for answer! it looks the fix is on the way https://github.com/charmed-kubernetes/charm-flannel/pull/73/commits/fa3e57d60d194d8c5bc099495958f448c02c5ecc so i will wait for merge and try again :)
bw3u avatar
cn flag
@Viktorbs It seems its already merged but `in progress` in Launchpad so initial release can take time as you said :) If this answer was helpful you can accept it by clicking to tick button. Have a nice day!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.