【问题标题】:How to Add Secret yaml in Azure DevOps pipeline for AKS如何在 AKS 的 Azure DevOps 管道中添加 Secret yaml
【发布时间】:2022-11-05 23:01:40
【问题描述】:

我在 AKS 中尝试了一些东西。现在我正在尝试通过 Azure DevOps 发布到 AKS。但我怀疑我有 3 个 yaml 文件(ConfigMap、Deployment 和 Secret),我在 deployment.yaml 文件中提到了以下内容

envFrom:
        - secretRef:
            name: webinar-web-app-secret
        - configMapRef:
            name: webinar-web-app-configmap

现在我的发布文件看起来像这样。请指导我如何在管道中添加 secret.yaml 文件

trigger: 
  - master

pool:
  vmImage: ubuntu-latest
  
resources:
- repo: self

stages:
- stage: 'Deployment_AKS_Prod'
  displayName: 'Deploy To AKS prod'
  jobs:
    - deployment: Release
      environment: 'test-aks.prod'
      displayName: 'Release'
      strategy:
        runOnce:
          deploy:
            steps:
            - checkout: self

            - task: Kubernetes@1
              displayName: Deploying Manifests into AKS
              inputs:
                connectionType: 'Azure Resource Manager'
                azureSubscriptionEndpoint: 'aks'
                azureResourceGroup: 'test-rg'
                kubernetesCluster: 'test-aks'
                namespace: 'prod'
                command: 'apply'
                useConfigurationFile: true
                configuration: '$(Build.SourcesDirectory)/deployment/webinar-app.yaml'
                secretType: 'dockerRegistry'
                containerRegistryType: 'Azure Container Registry'
                useConfigMapFile: true
                configMapFile: '$(Build.SourcesDirectory)/deployment/configmap.yaml'

【问题讨论】:

    标签: azure kubernetes azure-devops azure-aks azure-pipelines-yaml


    【解决方案1】:

    通过指定一个目录,您可以在 Kubernetes@1 任务的配置输入下部署多个文件。 (因此,在您的情况下,您可以将 yaml 文件放在一个文件夹下,但指定它们的种类。

    (https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/kubernetes-v1?view=azure-pipelines#:~:text=configuration%20%2D%20File%20path)

    https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#describing-a-kubernetes-object

    【讨论】:

      猜你喜欢
      • 2020-05-23
      • 2022-12-05
      • 2022-11-14
      • 2020-08-07
      • 2022-08-02
      • 2020-05-28
      • 2021-12-23
      • 2021-08-19
      • 1970-01-01
      相关资源
      最近更新 更多