是否可以使用LoadbalancerIP将metalLB分配给ingressgateway?鉴于这个yaml引发了一个关于loadBalancerIP (io.istio.networking.v1alpha3.Gateway.spec中的“未知字段”"loadBalancerIP“)的错误,我可以使用‘-验证=假’标志绕过它,但是metalLB没有分配正确的IP地址?
test.yaml:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: httpbin-gateway
spec:
loadBalancerIP: 10.0.0.242
selector:
istio: ingressgateway # use Istio default gateway implementation
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: httpbin
spec:
hosts:
- "*"
gateways:
- httpbin-gateway
http:
- match:
- uri:
prefix: /headers
route:
- destination:
port:
number: 8000
host: httpbin2层:
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: nips
protocol: layer2
addresses:
- 10.0.0.206-10.0.0.225
auto-assign: true
- name: mainips
protocol: layer2
addresses:
- 10.0.0.230-10.0.0.239
auto-assign: false
- name: cheapips
protocol: layer2
addresses:
- 10.0.0.240-10.0.0.249
auto-assign: false
- name: web
protocol: layer2
addresses:
- 10.0.0.203-10.0.0.205
auto-assign: false运行kubectl命令:
$ kubectl apply -f /tmp/test.yaml
error: error validating "/tmp/test.yaml": error validating data: ValidationError(Gateway.spec): unknown field "loadBalancerIP" in io.istio.networking.v1alpha3.Gateway.spec; if you choose to ignore these errors, turn validation off with --validate=false
$ kubectl apply --validate=false -f /tmp/test.yaml
gateway.networking.istio.io/httpbin-gateway created
virtualservice.networking.istio.io/httpbin created
$ kubectl get svc -n istio-system -o wide istio-ingressgateway
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
istio-ingressgateway LoadBalancer 10.108.199.32 10.0.0.206 15021:31659/TCP,80:30780/TCP,443:30769/TCP 17h app=istio-ingressgateway,istio=ingressgateway注意,它从MetalLB获得了错误的外部IP地址。
发布于 2021-12-16 10:37:49
我认为在安装Istio时,您需要使用一个ingressGateway设置IstioOperator上的IP地址。不是在你的虚拟网关上。
使用配置创建yaml文件:
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
components:
ingressGateways:
- name: istio-ingressgateway
enabled: true
k8s:
service:
type: LoadBalancer
loadBalancerIP: 10.0.0.242如果在安装Istio时没有提供操作符,则将使用默认配置,因此请确保向ingressGateway部件添加任何希望保留的值。此配置将与默认配置合并。
要获得当前配置:
kubectl get istiooperators.install.istio.io -n istio-system installed-state -o yaml
然后在安装Istio时应用此配置:
istioctl install \
-f k8s/istio/gateways.yamlIstioOperator的所有选项:
https://istio.io/latest/docs/reference/config/istio.operator.v1alpha1/
https://stackoverflow.com/questions/70324435
复制相似问题