Я новичок в Kubernetes, и мне нужно создать под, используя Kubernetes python -client . Итак, чтобы поэкспериментировать, я пытаюсь запустить примеры записных книжек , предоставленные проектом, без каких-либо изменений, чтобы увидеть, как все работает.
Начиная с intro_notebook.ipynb на третьем месте step Я получаю сообщение об ошибке:
ValueError: Invalid value for `selector`, must not be `None`
Вот код:
from kubernetes import client, config
Единственная часть, которую я изменил, - это вторая ячейка, потому что я запускаю Kubernetes, используя * Ubuntu microk8s
:
config.load_kube_config('/var/snap/microk8s/current/credentials/client.config')
api_instance = client.AppsV1Api()
dep = client.V1Deployment()
spec = client.V1DeploymentSpec() # <<< At this line I hit the error!
Полная трассировка:
ValueError Traceback (most recent call last)
<ipython-input-9-f155901e8381> in <module>
1 api_instance = client.AppsV1Api()
2 dep = client.V1Deployment()
----> 3 spec = client.V1DeploymentSpec()
~/.local/share/virtualenvs/jupyter-2hJZ4kgI/lib/python3.8/site-packages/kubernetes/client/models/v1_deployment_spec.py in __init__(self, min_ready_seconds, paused, progress_deadline_seconds, replicas, revision_history_limit, selector, strategy, template)
76 if revision_history_limit is not None:
77 self.revision_history_limit = revision_history_limit
---> 78 self.selector = selector
79 if strategy is not None:
80 self.strategy = strategy
~/.local/share/virtualenvs/jupyter-2hJZ4kgI/lib/python3.8/site-packages/kubernetes/client/models/v1_deployment_spec.py in selector(self, selector)
215 """
216 if selector is None:
--> 217 raise ValueError("Invalid value for `selector`, must not be `None`") # noqa: E501
218
219 self._selector = selector
ValueError: Invalid value for `selector`, must not be `None`
Я работаю python3.8
:
$ pip freeze | grep -e kuber
kubernetes==11.0.0
$ snap list microk8s
Name Version Rev Tracking Publisher Notes
microk8s v1.18.6 1551 latest/stable canonical✓ classic
Обновление
Понижение версии microk8s до v1.15.11 не решило проблему.