kubernetes在azure blob存储上创建持久的卷

时间:2018-02-15 16:37:07

标签: kubernetes-helm azure-kubernetes

背景

我是kubernetes的新手,我正在尝试使用AKS群集上的helm图表安装Traceback (most recent call last): File "manage.py", line 15, in <module> execute_from_command_line(sys.argv) File "/home/irakliy01/Projects/Project/PythonVEnv/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line utility.execute() File "/home/irakliy01/Projects/Project/PythonVEnv/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute django.setup() File "/home/irakliy01/Projects/Project/PythonVEnv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/home/irakliy01/Projects/Project/PythonVEnv/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate app_config = AppConfig.create(entry) File "/home/irakliy01/Projects/Project/PythonVEnv/lib/python3.6/site-packages/django/apps/config.py", line 116, in create mod = import_module(mod_path) File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/irakliy01/Projects/Project/PythonVEnv/lib/python3.6/site-packages/django/contrib/contenttypes/apps.py", line 9, in <module> from .management import ( File "/home/irakliy01/Projects/Project/PythonVEnv/lib/python3.6/site-packages/django/contrib/contenttypes/management/__init__.py", line 2, in <module> from django.db import DEFAULT_DB_ALIAS, migrations, router, transaction File "/home/irakliy01/Projects/Project/PythonVEnv/lib/python3.6/site-packages/django/db/migrations/__init__.py", line 1, in <module> from .migration import Migration, swappable_dependency # NOQA ModuleNotFoundError: No module named 'django.db.migrations.migration' ,并希望设置一个持久的卷供它使用。

创建AKS群集时,它会将所有实际资源保留在资源组MC_XXX_XXXX

  • 我通过azure via azure portal手动创建了ABC-BLOB-STORAGE
  • 使用stable/prometheus
  • 创建了持久性卷
  • 尝试使用带有值文件的helm安装prometheus

持续音量

kubectl

Values.YAML(与存储相关的代码段)

apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
  name: azurefile
  annotations:
    storageclass.beta.kubernetes.io/is-default-class: "true"
  labels:
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: EnsureExists
provisioner: kubernetes.io/azure-disk
parameters:
  skuName: Standard_LRS
  location: eastus
  storageAccount: ABC-BLOB-STORAGE

错误

当我使用helm安装prometheus时:

prometheus: name: prometheus server: configMapOverrideName: prometheus-config persistentVolume: enabled: true storageClass: azurefile size: 10Gi

  

错误:发布d02失败:persistentvolumeclaims“d02-prometheus-alertmanager”被禁止

  • 感觉像kubernetes需要访问blob存储。我可以传入访问令牌但不确定如何

1 个答案:

答案 0 :(得分:0)

我不确定你是否可以挂载一个尚不存在的PersistentVolume并让它自动配置,我认为你需要首先制作一个PersistentVolumeClaim。声明从StorageClass启动卷的配置(或回收),卷的秘密应在配置时自动创建。请尝试以下

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: azurefile
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: azurefile
  resources:
    requests:
      storage: 10Gi

要在您的广告连播中使用该声明,此类内容应该有效。

prometheus:
    name: prometheus
    server:
      configMapOverrideName: prometheus-config
         volumeMounts:
         - mountPath: "/foo/mount_point"
           name: volume
         volumes:
           - name: volume
             persistentVolumeClaim:
               claimName: azurefile

以下:https://docs.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv