Environment
Istio Version: 1.3.4 (also tried 1.2.9)
K8s Version: 1.14.6
helm Version: 2.15.1
OS: CentOS 7.5
Problem
I am new to Istio and have tried out sample bookinfo application which works perfectly. To test canary deployments, I have updated the VirtualService
of reviews
service and it seems to be working fine.
root@box81:~# k get VirtualService reviews -o yaml --export
Flag --export has been deprecated, This flag is deprecated and will be removed in future.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{},"name":"reviews","namespace":"default"},"spec":{"hosts":["reviews"],"http":[{"route":[{"destination":{"host":"reviews","subset":"v1"}}]}]}}
generation: 1
name: reviews
selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
weight: 95
- destination:
host: reviews
subset: v2
weight: 5
root@box81:~#
The problem occurs when I try to host my own service and test canary deployments. Seems like my VirtualService
gets ignored completely. I have tried to compare both the services line by line but can’t figure what am I missing.
Based on my configuration, my service app-test
should server around 90% traffic to v1 and 10% to v2.
Files
---
apiVersion: v1
kind: Service
metadata:
labels:
app: app-test
service: app-test
name: app-test
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: app-test
sessionAffinity: None
type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: app-test
version: v1
name: app-test-v1
spec:
replicas: 1
selector:
matchLabels:
app: app-test
version: v1
template:
metadata:
labels:
app: app-test
version: v1
spec:
containers:
- name: app-test
image: vikas027/site-counter
ports:
- containerPort: 80
protocol: TCP
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: app-test
version: v2
name: app-test-v2
spec:
replicas: 1
selector:
matchLabels:
app: app-test
version: v2
template:
metadata:
labels:
app: app-test
version: v2
spec:
containers:
- name: app-test
image: vikas027/site-counter
ports:
- containerPort: 80
protocol: TCP
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: app-test
spec:
host: app-test
subsets:
- labels:
version: v1
name: v1
- labels:
version: v2
name: v2
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: app-test
spec:
hosts:
- app-test
http:
- route:
- destination:
host: app-test
subset: v1
weight: 90
- destination:
host: app-test
subset: v2
weight: 10
Logs and Screenshot
root@box81:~# istioctl version
client version: 1.3.4
control plane version: 1.3.4
root@box81:~#
root@box81:~# istioctl proxy-status | egrep 'reviews|app-test'
app-test-v1-74bfc9d756-j7dq6.default SYNCED SYNCED SYNCED SYNCED istio-pilot-f656669f6-dc8kn 1.3.4
app-test-v2-5bf6795f89-9g5p4.default SYNCED SYNCED SYNCED SYNCED istio-pilot-f656669f6-dc8kn 1.3.4
reviews-v1-75b979578c-h5bvg.default SYNCED SYNCED SYNCED SYNCED istio-pilot-f656669f6-dc8kn 1.3.4
reviews-v2-597bf96c8f-49wmr.default SYNCED SYNCED SYNCED SYNCED istio-pilot-f656669f6-dc8kn 1.3.4
reviews-v3-54c6c64795-shggw.default SYNCED SYNCED SYNCED SYNCED istio-pilot-f656669f6-dc8kn 1.3.4
root@box81:~#