So i am running a sample app to test canary weighted routing. I have created a sample app hello with two different versions, hellov1 and hellov2.
But unfortunately all my traffic goes into hellov2. Need urgent help as i have already spent 3-4 days figuring out. Here are the details -
minikube version: v1.23.2 with docker driver - 8GB and 4 cores.
istioctl version -
client version: 1.11.3
control plane version: 1.11.3
data plane version: 1.11.3 (10 proxies)
kubectl version
Client Version: version.Info{Major:“1”, Minor:“22”, GitVersion:“v1.22.2”, GitCommit:“8b5a19147530eaac9476b0ab82980b4088bbc1b2”, GitTreeState:“clean”, BuildDate:“2021-09-15T21:38:50Z”, GoVersion:“go1.16.8”, Compiler:“gc”, Platform:“darwin/amd64”}
Server Version: version.Info{Major:“1”, Minor:“22”, GitVersion:“v1.22.2”, GitCommit:“8b5a19147530eaac9476b0ab82980b4088bbc1b2”, GitTreeState:“clean”, BuildDate:“2021-09-15T21:32:41Z”, GoVersion:“go1.16.8”, Compiler:“gc”, Platform:“linux/amd64”}
Here are my yml files -
builder.yml
---
apiVersion: v1
kind: Service
metadata:
name: hello
labels:
app: hello
service: hello
spec:
ports:
- port: 8084
name: http
selector:
app: hello
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: hellosvc
labels:
account: hello
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-v1
labels:
app: hello
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: hello
version: v1
template:
metadata:
labels:
app: hello
version: v1
spec:
serviceAccountName: hellosvc
containers:
- name: hellov1
image: hellov1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8084
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-v2
labels:
app: hello
version: v2
spec:
replicas: 1
selector:
matchLabels:
app: hello
version: v2
template:
metadata:
labels:
app: hello
version: v2
spec:
serviceAccountName: hellosvc
containers:
- name: hellov2
image: hellov2
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8084
---
svc.yml
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: hello-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: hello
spec:
hosts:
- "*"
gateways:
- hello-gateway
http:
- match:
- uri:
exact: /
- uri:
prefix: /hello
- uri:
exact: /hello
route:
- destination:
host: hello
subset: v1
port:
number: 8084
weight: 60
- destination:
host: hello
subset: v2
port:
number: 8084
weight: 40
dest.yml
kind: DestinationRule
metadata:
name: hello
spec:
host: hello
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
---
Here are the cluster status -
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
details ClusterIP 10.107.131.47 9080/TCP 59m
hello ClusterIP 10.99.71.99 8084/TCP 12m
kubernetes ClusterIP 10.96.0.1 443/TCP 3h38m
productpage ClusterIP 10.99.41.148 9080/TCP 59m
ratings ClusterIP 10.105.254.39 9080/TCP 59m
reviews ClusterIP 10.103.14.122 9080/TCP 59m
kubectl get pods
NAME READY STATUS RESTARTS AGE
details-v1-79f774bdb9-ctpnz 2/2 Running 0 60m
hello-v1-bcb9966fd-r8mpx 2/2 Running 0 13m
hello-v2-5b9556d74d-c5lnm 2/2 Running 0 13m
productpage-v1-6b746f74dc-s4dn2 2/2 Running 0 60m
ratings-v1-b6994bb9-d57tw 2/2 Running 0 60m
reviews-v1-545db77b95-rk46j 2/2 Running 0 60m
reviews-v2-7bf8c9648f-25bl5 2/2 Running 0 60m
reviews-v3-84779c7bbc-rdcdk 2/2 Running 0 60m
Finally I even checked the pod description -
istioctl experimental describe pod hello-v1-bcb9966fd-r8mpx
Pod: hello-v1-bcb9966fd-r8mpx
Pod Ports: 8084 (hellov1), 15090 (istio-proxy)
--------------------
Service: hello
Port: http 8084/HTTP targets pod port 8084
DestinationRule: hello for "hello"
Matching subsets: v1
(Non-matching subsets v2)
No Traffic Policy
Exposed on Ingress Gateway http://192.168.49.2
VirtualService: hello
Weight 60%
/, /hello*, /hello
Pod: hello-v2-5b9556d74d-c5lnm
Pod Ports: 8084 (hellov2), 15090 (istio-proxy)
--------------------
Service: hello
Port: http 8084/HTTP targets pod port 8084
DestinationRule: hello for "hello"
Matching subsets: v2
(Non-matching subsets v1)
No Traffic Policy
Exposed on Ingress Gateway http://192.168.49.2
VirtualService: hello
Weight 40%
/, /hello*, /hello
But all my traffic goes to hello-v2
Any help would be great