[英]How to assign external IP address to running service?
I have the following service:我有以下服务:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
rancher ClusterIP 10.245.162.197 <none> 80/TCP 10h
that I would like to assign an EXTERNAL-IP to it.我想为它分配一个EXTERNAL-IP 。 I tried:我试过了:
kubectl expose deployment rancher --type=LoadBalancer --name=rancher-access
but the EXTERNAL-IP does not still get assigned.但仍没有分配外部 IP 。 I am using Digital Ocean Kubernetes.我正在使用数字海洋 Kubernetes。
How to get an EXTERNAL-IP for rancher
service.如何为rancher
服务获取外部 IP 。
You have two options:你有两个选择:
Instead, you should consider using a NodePort service or attaching an ExternalIP to your service and mapping the exposed IP to a Digital Ocean's floating IP.相反,您应该考虑使用NodePort服务或将ExternalIP附加到您的服务并将暴露的 IP 映射到 Digital Ocean 的浮动 IP。
To get the actual IP you need to expose you need to ssh into your gateway droplet and find its anchor IP by hitting up the metadata service:要获得实际的 IP,您需要将 ssh 公开到您的网关 droplet 中,并通过访问元数据服务找到其锚点 IP:
curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address
Use Digital Ocean created cloud provider implementation使用 Digital Ocean 创建的云提供商实施
You could use an NGINX ingress controller and point a DigitalOcean LB to the host where the controller is deployed.您可以使用 NGINX 入口 controller 并将 DigitalOcean LB 指向部署了 controller 的主机。 With some more tinkering you could probably make this a highly available setup通过更多的修补,您可能会使其成为一个高度可用的设置
https://github.com/hobby-kube/guide#bringing-traffic-to-the-cluster https://github.com/hobby-kube/guide#bringing-traffic-to-the-cluster
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.