我正在我的机构的RedHat服务器中设置Kubernetes,该服务器的内部IP为10.2.3.4。我只能用kubectl端口向前看吊舱。e.g
我的traefik服务有以下内容:
#minikube service list
| kube-system | traefik | web/80 | http://172.17.0.3:31909 |
| | | websecure/443 | http://172.17.0.3:30584 |
| | | admin/9001 | http://172.17.0.3:32316 |
|-------------|------------|---------------|-------------------------|现在我只能卷起这个链接
$curl http://172.17.0.3:32316/dashboard/
<!DOCTYPE html><html><head><title>Traefik</title><meta charset=utf-8> ........但是,如果我想在我的浏览器上预览9001端口上的管理仪表板,我找到的唯一方法是通过端口转发:
kubectl port-forward -n kube-system $(kubectl get pods --output=name -n kube-system | grep 'traefik') --address 10.2.3.4 9001:9001我试图在服务YAML设置上设置externalIPs,但它不起作用:
# Service
---
apiVersion: v1
kind: Service
metadata:
labels:
app: traefik
release: traefik
name: traefik
namespace: kube-system
spec:
externalIPs:
- 10.2.3.4
externalTrafficPolicy: Local
ports:
- name: web
nodePort: 31909
port: 3838
protocol: TCP
targetPort: 3838
- name: admin
nodePort: 32316
port: 9001
protocol: TCP
targetPort: 9001
selector:
app: traefik
release: traefik
sessionAffinity: None
type: LoadBalancer
status:
loadBalancer: {}我知道端口转发应该在调试模式中使用,我不能添加我自己的域,因为它在我的机构中是受限的,我想知道是否应该将kubernete服务公开到10.2.3.4中。
发布于 2020-05-27 17:59:47
公开服务的简单方法是
kubectl expose deployment *name* --type=LoadBalancer --name=trafik名称-表示您应该在deployment.yaml中提供的部署名称
我假设,您在这里使用traefik作为网关/负载均衡器。您可以对任何服务使用相同的执行来公开内部IP。
https://stackoverflow.com/questions/62049507
复制相似问题