首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法将私有注册表凭据传递给Azure Iot Edge

问无法将私有注册表凭据传递给Azure Iot Edge
EN

Stack Overflow用户
提问于 2019-02-05 17:43:08
回答 1查看 851关注 0票数 1

我正在使用kubernetes与虚拟-kubelet部署模块到物联网边缘。一切都与公众形象完美配合。我想不出怎么把凭据传给我的私人登记处。

这个文档https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/iot-edge/iot-edge-runtime.md说:

settings.image - IoT边缘代理用来启动模块的容器映像。如果图像受密码保护,则必须将IoT边缘代理配置为容器注册表的凭据。可以使用部署清单、或IoT边缘设备本身通过更新IoT边缘程序文件夹中的config.yaml文件远程配置容器注册表的凭据。

看起来很容易,但是找不到如何修改config.yaml来添加我的凭据。我认为应该在下面一节中加上,但没有例子说明如何做到这一点。

代码语言:javascript
复制
###############################################################################
# Edge Agent module spec
###############################################################################
#
# Configures the initial Edge Agent module.
#
# The daemon uses this definition to bootstrap the system. The Edge Agent can
# then update itself based on the Edge Agent module definition present in the
# deployment in IoT Hub.
#
###############################################################################

agent:
  name: "edgeAgent"
  type: "docker"
  env:
    RuntimeLogLevel: debug
  config:
    image: "mcr.microsoft.com/azureiotedge-agent:1.0"
    auth: {}

YAML

代码语言:javascript
复制
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: matrix
spec:
  selector:
    matchLabels:
      app: matrix
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 0%
      maxUnavailable: 100%
  template:
    metadata:
      labels:
        app: matrix
      annotations:
        isEdgeDeployment: "true"
        targetCondition: "tags.type='gpu'"
        priority: "151"
        loggingOptions: ""
    spec:
      affinity:
          podAntiAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - matrix
              topologyKey: "kubernetes.io/hostname"
      containers:
      - name: matrix
        image: "registry.xxx.xx/image/xxx-frontend"
        env:
        - name: DISPLAY
          value: ":0.0"
      nodeSelector:
        type: virtual-kubelet
      tolerations:
      - key: virtual-kubelet.io/provider
        operator: Equal
        value: iotedge
        effect: NoSchedule

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: matrix
data:
  status: running
  restartPolicy: always
  version: "1.0"
  createOptions: |
    {
      "HostConfig": {
        "Privileged": "true",
        "Mounts": [{"Target": "/tmp/.X11-unix/","Source": "/tmp/.X11-unix/","Type": "bind"}],
        "network": "host"
      }
    }
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: edgeagent
data:
  desiredProperties: |
    {
      "runtime": {
        "settings": {
          "registryCredentials": {
            "docker": {
              "address": "registry.xxx.xx",
              "password": "xxxxxxxxxxxxxxx",
              "username": "user"
            }
          }
        }
      },
      "systemModules": {
        "edgeHub": {
          "env": {
            "OptimizeForPerformance": {
              "value": "false"
            }
          }
        }
      }
    }
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: edgehub
data:
  desiredProperties: |
    {
      "routes": {
        "route": "FROM /* INTO $upstream",
      },
      "storeAndForwardConfiguration": {
        "timeToLiveSecs": 6
      }
    }
EN

回答 1

Stack Overflow用户

发布于 2019-02-05 18:40:25

可以将其添加到edgeAgent configMap中,如下所示:

代码语言:javascript
复制
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: edgeagent
data:
  desiredProperties: |
    {
      "runtime": {
        "settings": {
          "registryCredentials": {
            "docker": {
              "address": "preview.azurecr.io",
              "password": "xyz",
              "username": "abc"
            }
          }
        }
      }
    }
---
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54540187

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档