标签:nginx stat inline match adb sse arp mat deploy
自建Kubernetes的LoadBalancer类型服务方案-MetalLB[TOC]
kubernetes环境:
helm fetch --untar stable/metallb
cd metallb
vim values.yaml # 配置ip池
helm install --name metallb --namespce kube-system ./
configInline:
# Example ARP Configuration
address-pools:
- name: default
protocol: layer2
addresses:
- 192.168.105.170-192.168.105.175
示例:
nginx-metallb.yaml
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx-metallb
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- name: http
containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-metallb
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
type: LoadBalancer
正常结果是可以看到svc的EXTERNAL-IP列有分配IP池中的地址,kubernetes外部也可以访问。
# 访问测试
lb_ip=$(kubectl get svc nginx-metallb -ojsonpath={.status.loadBalancer.ingress[0].ip})
curl $lb_ip
参考链接:
[1] https://metallb.universe.tf/
自建Kubernetes的LoadBalancer类型服务方案-MetalLB
标签:nginx stat inline match adb sse arp mat deploy
原文地址:https://blog.51cto.com/ygqygq2/2366858