Bug Description
Hi All, running into some odd behavior with DestinationRule workloadSelector and was hoping you could shed some light. I am attempting to have a hybrid ServiceEntry which references pods and WorkloadEntries and balances between them as described in the docs.
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: external-svc
spec:
hosts:
- failover-istio-lb.testing.mydomain.com
location: MESH_INTERNAL
ports:
- number: 80
name: http
protocol: HTTP
targetPort: 8080
resolution: DNS
workloadSelector:
labels:
app: echo-edge-istio
This is functioning well and traffic can be directed to both destinations. The issue comes into play with the WorkloadEntrys requiring a TLS traffic policy of SIMPLE and the internal pods not requiring this.
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: external-svc
spec:
host: failover-istio-lb.testing.mydomain.com
# workloadSelector:
# matchLabels:
# app: echo-edge-istio
trafficPolicy:
tls:
mode: SIMPLE
So I figured adding a workloadSelector matchLabel to the destination rule would be the solution here - unfortunately I cant seem to get it to work. If I do not specify the selector, then all traffic has the rule applied and half the connections are successful (as expected). When I add a selector it doen’t appear to take affect at all (even when I set the selector to the same selector label used in the ServiceEntry to direct traffic to both destinations it does not apply to either end). I had expected this to perform the same as not having a selector given that the DR should apply to both destinations in the Service Entry.
The workload entry is labeled with:
labels:
app: echo-edge-istio
class: cloud
and the pods are labeled with:
labels:
app: echo-edge-istio
class: pod
and I have tried using match labels of app: echo-edge-istio
, class: cloud
and class: pod
with no success (DR does not apply to either).
regardless of the workloadselector on the destination rule, the command
./istioctl pc cluster echo-edge-istio-688b469d74-5msxx
still shows the destination rule applied however the behavior is as if the DR does not exist
failover-istio-lb.testing.mydomain.com 80 - outbound STRICT_DNS external-svc.edge-istio
Also when trying to verify rules with experimental describe it doesnt show any DRs applied regardless of selector or not, however changing the DR impacts the traffic as expected
./istioctl x describe pod echo-edge-istio-688b469d74-5msxx
Pod: echo-edge-istio-688b469d74-5msxx
Pod Revision: default
Pod Ports: 8080 (echo), 15090 (istio-proxy)
Suggestion: add 'version' label to pod for Istio telemetry.
--------------------
Service: echo-edge-istio
Port: low 80/UnsupportedProtocol targets pod port 8080
--------------------
Effective PeerAuthentication:
Workload mTLS mode: PERMISSIVE
Ideally what im looking for is a method to have a blanket destination rule for a given host (loadbalancing/outlier detection/etc) and then have a specific DR for the workloadentries via selector to set the TLS trafficpolicy on just those objects. Not sure where I can go about debugging from here, have even tried setting the inverse thinking the selector only applied to pods (base rule of TLS simple with a DR + selector to disable on pods but no luck). Would be happy to dump configs/more info if its helpful
Version
$ istioctl version
client version: 1.16.1
control plane version: 1.16.1
data plane version: 1.16.1 (2 proxies)
$ kubectl version --short
Client Version: v1.24.0
Kustomize Version: v4.5.4
Server Version: v1.23.14+rke2r1
Additional Information
./istioctl bug-report
Target cluster context: testing
Running with the following config:
istio-namespace: istio-system
full-secrets: false
timeout (mins): 30
include: { }
exclude: { Namespaces: kube-node-lease,kube-public,kube-system,local-path-storage }
end-time: 2023-01-04 15:11:48.388494 -0500 EST
Cluster endpoint: redacted
CLI version:
version.BuildInfo{Version:"1.16.1", GitRevision:"f6d7bf648e571a6a523210d97bde8b489250354b", GolangVersion:"go1.19.4", BuildStatus:"Clean", GitTag:"1.16.1"}
The following Istio control plane revisions/versions were found in the cluster:
Revision default:
&version.MeshInfo{
{
Component: "pilot",
Info: version.BuildInfo{Version:"1.16.1", GitRevision:"f6d7bf648e571a6a523210d97bde8b489250354b", GolangVersion:"", BuildStatus:"Clean", GitTag:"1.16.1"},
},
}
The following proxy revisions/versions were found in the cluster:
Revision default: Versions {1.16.1}
Fetching proxy logs for the following containers:
calico-system//calico-node-bnrln/calico-node
calico-system//calico-node-z6spp/calico-node
calico-system//calico-node-zxwqj/calico-node
calico-system/calico-kube-controllers/calico-kube-controllers-7897f79447-xd2vn/calico-kube-controllers
calico-system/calico-typha/calico-typha-79f569f5f7-tkgnb/calico-typha
calico-system/calico-typha/calico-typha-79f569f5f7-xbql6/calico-typha
cattle-fleet-system/fleet-agent/fleet-agent-5779d486dc-xq74z/fleet-agent
cattle-system/cattle-cluster-agent/cattle-cluster-agent-6cb6596fb8-jvf8x/cluster-register
cattle-system/cattle-cluster-agent/cattle-cluster-agent-6cb6596fb8-xl6k2/cluster-register
cattle-system/system-upgrade-controller/system-upgrade-controller-7f9f559b4f-2lslv/system-upgrade-controller
edge-istio/echo-edge-istio/echo-edge-istio-688b469d74-5msxx/echo
edge-istio/echo-edge-istio/echo-edge-istio-688b469d74-5msxx/istio-proxy
istio-system/istio-ingressgateway/istio-ingressgateway-598595fcf6-r5bts/istio-proxy
istio-system/istiod/istiod-5b86c45f48-7bxl2/discovery
metallb-system//speaker-fcjb2/speaker
metallb-system//speaker-hwjnq/speaker
metallb-system//speaker-w9pk9/speaker
metallb-system/controller/controller-7597dd4f7b-c249v/controller
upstream/echo-upstream/echo-upstream-588c888c78-8nbxc/echo
upstream/echo-upstream/echo-upstream-588c888c78-s9g8x/echo
upstream/echo-upstream/echo-upstream-588c888c78-ws9z5/echo
Fetching Istio control plane information from cluster.
Running istio analyze on all namespaces and report as below:
Analysis Report:
Error [IST0128] (DestinationRule edge-istio/external-svc-dns) DestinationRule edge-istio/external-svc in namespace edge-istio has TLS mode set to SIMPLE but no caCertificates are set to validate server identity for host: failover-istio-lb.testing.mydomain.com
Info [IST0102] (Namespace calico-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace calico-system istio-injection=enabled' to enable it, or 'kubectl label namespace calico-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace cattle-fleet-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace cattle-fleet-system istio-injection=enabled' to enable it, or 'kubectl label namespace cattle-fleet-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace cattle-impersonation-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace cattle-impersonation-system istio-injection=enabled' to enable it, or 'kubectl label namespace cattle-impersonation-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace cattle-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace cattle-system istio-injection=enabled' to enable it, or 'kubectl label namespace cattle-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace default) The namespace is not enabled for Istio injection. Run 'kubectl label namespace default istio-injection=enabled' to enable it, or 'kubectl label namespace default istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0118] (Service calico-system/calico-kube-controllers-metrics) Port name metrics-port (port: 9094, targetPort: 9094) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service calico-system/calico-typha) Port name calico-typha (port: 5473, targetPort: calico-typha) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service edge-istio/echo-edge-istio) Port name low (port: 80, targetPort: 8080) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service upstream/echo-upstream) Port name high (port: 8080, targetPort: 8080) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service upstream/echo-upstream) Port name low (port: 80, targetPort: 8080) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service metallb-system/webhook-service) Port name (port: 443, targetPort: 9443) doesn't follow the naming convention of Istio port.
area/networking