我已经使用kops 创建了kubernetes集群
kops create cluster
--dns-zone=vpc.abc.in
--master-zones=ap-southeast-1a,ap-southeast-1b,ap-southeast-1c
--zones=ap-southeast-1a,ap-southeast-1b,ap-southeast-1c
--node-count 3
--topology private
--networking flannel-vxlan
--node-size=t2.medium
--master-size=t2.micro
${NAME}
我使用的是私有拓扑和内部负载均衡器。
每当我创建类型为LoadBalancer的服务时,它都会创建一个面向公共的ELB,并且url可以公开访问。
我想部署Elastic Search和kibana,并使其仅在VPN内可用。我们已经设置了VPN。
如何在VPN中访问服务?
在服务定义中添加以下注释:
service.beta.kubernetes.io/aws-load-balancer-internal: '"true"'
完整示例:
kind: Service
apiVersion: v1
metadata:
name: my-service
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: '"true"'
spec:
selector:
app: MyApp
ports:
- protocol: TCP
port: 80
targetPort: 9376
type: LoadBalancer
这将提供内部ELB,而不是外部ELB。