我正在尝试使用以下yaml创建服务。正如您所看到的,我正在尝试限制来自10.0.0.0/8范围的服务访问。
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
ports:
# the port that this service should serve on
- port: 443
targetPort: 443
# label keys and values that must match in order to receive traffic for this service
selector:
name: nginx
type: LoadBalancer
loadBalancerSourceRanges:
- 10.0.0.0/8
有几个 Kubernetes 文档(如下所列)讨论如何使用 loadBalancerSourceRanges 注释来控制服务访问。
http://kubernetes.io/docs/user-guide/services-firewalls/
然而,当我尝试创建此服务时,我遇到了以下错误:
error validating "sdp-cluster.yaml": error validating data: found invalid field loadBalancerSourceRanges for v1.ServiceSpec; if you choose to ignore these errors, turn validation off with --validate=false
我查看了 v1.ServiceSpec,也没有找到它。
我错过了什么?我该如何限制 Kubernetes 中服务的流量?