【发布时间】:2021-02-04 13:47:45
【问题描述】:
我使用以下配置来设置 Istio
cat << EOF | kubectl apply -f -
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: istio-control-plane
spec:
# Use the default profile as the base
# More details at: https://istio.io/docs/setup/additional-setup/config-profiles/
profile: default
# Enable the addons that we will want to use
addonComponents:
grafana:
enabled: true
prometheus:
enabled: true
tracing:
enabled: true
kiali:
enabled: true
values:
global:
# Ensure that the Istio pods are only scheduled to run on Linux nodes
defaultNodeSelector:
beta.kubernetes.io/os: linux
kiali:
dashboard:
auth:
strategy: anonymous
components:
egressGateways:
- name: istio-egressgateway
enabled: true
EOF
我可以看到 istio 服务
kubectl 获取 svc -n istio-system
我已经部署了睡眠应用
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.7/samples/sleep/sleep.yaml
-n akv2k8s-test
并已部署 ServiceEntry
kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: httpbin-ext
namespace: akv2k8s-test
spec:
hosts:
- httpbin.org
ports:
- number: 80
name: http
protocol: HTTP
resolution: DNS
location: MESH_EXTERNAL
EOF
并尝试访问外部 URL
export SOURCE_POD=$(kubectl get -n akv2k8s-test pod -l app=sleep -o jsonpath='{.items..metadata.name}')
kubectl exec "$SOURCE_POD" -n akv2k8s-test -c sleep -- curl -sI http://httpbin.org/headers | grep "HTTP/";
但是我看不到代理上报告的任何日志
kubectl logs "$SOURCE_POD" -n akv2k8s-test -c istio-proxy | tail
根据文档我应该看到这个
但是我没有看到标题
我错过了什么吗?
【问题讨论】:
-
我不确定为什么没有标头,但理论上 istio egress 在这里不起作用,因为您没有使用它。查看文档here,您需要更多的组件才能实际使用它。如果这能回答您的问题,请告诉我。
-
根据文档,我已经部署了 ServiceEntry 。我还有什么遗漏的吗?
-
根据上述文档第 3 点和第 4 点,您缺少出口网关、目标规则和虚拟服务。服务条目允许将其他条目添加到 Istio 的内部服务注册表中,以便在网格中自动发现服务可以访问/路由到这些手动指定的服务。这不像您启用出口网关,只是每个流量都通过出口网关。
标签: azure kubernetes istio azure-aks istio-sidecar