【发布时间】:2022-11-05 03:22:35
【问题描述】:
我已经按照https://www.haproxy.com/documentation/kubernetes/latest/installation/community/azure/ 此处的文档在 AKS 中安装了 HAProxy 控制器。当我尝试按预期导航外部负载均衡器 IP 时,我得到了 404。然后我通过使用 hello world 映像将新应用程序部署到同一命名空间。
apiVersion: apps/v1
kind: Deployment
metadata:
name: aks-helloworld-one
spec:
replicas: 1
selector:
matchLabels:
app: aks-helloworld-one
template:
metadata:
labels:
app: aks-helloworld-one
spec:
containers:
- name: aks-helloworld-one
image: mcr.microsoft.com/azuredocs/aks-helloworld:v1
ports:
- containerPort: 80
env:
- name: TITLE
value: "Welcome to Azure Kubernetes Service (AKS)"
---
apiVersion: v1
kind: Service
metadata:
name: aks-helloworld-one
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
ports:
- name: http-port
port: 8000
protocol: TCP
targetPort: 80
selector:
app: aks-helloworld-one
然后我使用以下内容添加了入口文件的路径
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: test
spec:
ingressClassName: haproxy
rules:
- http:
paths:
- path: /helloworld
pathType: Prefix
backend:
service:
name: aks-helloworld-one
port:
number: 80
并部署。发布如果我导航到外部负载均衡器 ip /helloworld 仍然返回 404。我不确定我做错了什么。 这是命名空间中的当前服务列表
PS \HA 代理> kubectl get svc --namespace haproxy-controller
名称 类型 CLUSTER-IP EXTERNAL-IP PORT(S)
aks-helloworld-one ClusterIP 10.0.206.176 8000/TCP
haproxy-kubernetes-ingress 负载平衡器 10.0.138.212..**.**8 80:30778/TCP,443:32570/TCP,1024:31481/TCP
【问题讨论】:
标签: kubernetes kubernetes-ingress azure-aks haproxy haproxy-ingress