【发布时间】:2020-12-03 18:16:16
【问题描述】:
我正在尝试将我的部署自动化到 Azure AKS,但试图弄清楚如何在我的清单文件中引用图像名称。目前我已经注释掉了清单文件中的图像名称,所以看看它是否有效但得到一个错误:
##[error]TypeError: 无法读取未定义的属性“修剪”
这是我的 Github 工作流文件:
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: Azure/docker-login@v1
with:
login-server: registry.azurecr.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build . --file Dockerfile_nginx -t registry.azurecr.io/k8sdemo:${{ github.sha }}
docker push registry.azurecr.io/k8sdemo:${{ github.sha }}
- uses: Azure/k8s-set-context@v1
with:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- uses: Azure/k8s-deploy@v1
with:
manifests: |
k8s/mg-k8s/nginx.yaml
images: |
registry.azurecr.io/k8sdemo:${{ github.sha }}
imagepullsecrets: |
secret
这是我的清单文件:
apiVersion: v1
kind: Service
metadata:
name: nginxstaticservice
namespace: mg-staging
labels:
app: nginxstatic
spec:
selector:
k8s-app: traefik-ingress-lb
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
# selector:
# app: nginxstatic
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginxstatic-deployment
namespace: mg-staging
labels:
app: nginxstatic
spec:
replicas: 1
selector:
matchLabels:
app: nginxstatic
template:
metadata:
labels:
app: nginxstatic
spec:
containers:
- name: nginxstatic
# image:
imagePullPolicy: "Always"
ports:
- containerPort: 80
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/conf.d
volumes:
- name: nginx-config
configMap:
name: nginx-configmap
imagePullSecrets:
- name: secret
【问题讨论】:
标签: kubernetes github-actions azure-aks