【发布时间】:2022-01-24 04:28:45
【问题描述】:
我是 Azure Kubernetes 服务的新手。我创建了一个 Azure Kubernetes 集群并尝试在其中部署一些工作负载。 .yaml文件如下
- apiVersion: v1
kind: Namespace
metadata:
name: azure-vote
spec:
finalizers:
- kubernetes
- apiVersion: apps/v1
kind: Deployment
metadata:
name: azure-vote-back
namespace: azure-vote
spec:
replicas: 1
selector:
matchLabels:
app: azure-vote-back
template:
metadata:
labels:
app: azure-vote-back
spec:
nodeSelector:
beta.kubernetes.io/os: linux
containers:
- name: azure-vote-back
image: mcr.microsoft.com/oss/bitnami/redis:6.0.8
env:
- name: ALLOW_EMPTY_PASSWORD
value: 'yes'
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 6379
name: redis
- apiVersion: v1
kind: Service
metadata:
name: azure-vote-back
namespace: azure-vote
spec:
ports:
- port: 6379
selector:
app: azure-vote-back
- apiVersion: apps/v1
kind: Deployment
metadata:
name: azure-vote-front
namespace: azure-vote
spec:
replicas: 1
selector:
matchLabels:
app: azure-vote-front
template:
metadata:
labels:
app: azure-vote-front
spec:
nodeSelector:
beta.kubernetes.io/os: linux
containers:
- name: azure-vote-front
image: mcr.microsoft.com/azuredocs/azure-vote-front:v1
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
env:
- name: REDIS
value: azure-vote-back
- apiVersion: v1
kind: Service
metadata:
name: azure-vote-front
namespace: azure-vote
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: azure-vote-front
当我通过 Azure CLI 部署此 .yaml 时,它给了我一个验证错误,但没有指出它在哪里?当我运行 kubectl apply -f ./filename.yaml --validate=false 它给出 "cannot unmarshal array into Go value of type unstructured.detector" 错误。但是,当我在 Azure 门户 UI 中运行相同的 yaml 时,它运行时没有任何错误。是否有人可以提及此问题的原因以及如何解决此问题,不胜感激。
【问题讨论】:
-
嗨@Rama,AnsumanBal-MT 的答案是否回答了您的问题?如果是,请考虑consider up-voting / accepting it。
标签: azure kubernetes azure-aks azure-cli