{"id":307909,"date":"2020-08-03T15:00:49","date_gmt":"2020-08-03T15:00:49","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307909"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307909","title":{"rendered":"Canary Deployment \u0432 Kubernetes #3: Istio"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/nixys\/blog\/513578\/\">\n<h3 id=\"ispolzovanie-istiokiali-dlya-zapuska-i-vizualizacii-canary-deploya\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Istio+Kiali \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Canary \u0434\u0435\u043f\u043b\u043e\u044f<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wk\/ha\/jd\/wkhajdxpv7o_4thn574lsanbzbe.jpeg\">  <\/p>\n<hr>\n<p>  <\/p>\n<h4 id=\"stati-etogo-cikla\">\u0421\u0442\u0430\u0442\u044c\u0438 \u044d\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430<\/h4>\n<p>  <\/p>\n<ol>\n<li><a href=\"https:\/\/habr.com\/en\/company\/nixys\/blog\/512766\/\">Canary Deployment \u0432 Kubernetes #1: Gitlab CI<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/en\/company\/nixys\/blog\/513118\/\">Canary Deployment \u0432 Kubernetes #2: Argo Rollouts<\/a><\/li>\n<li>(\u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f)<\/li>\n<li>Canary Deployment \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Jenkins-X Istio Flagger<\/li>\n<\/ol>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3 id=\"canary-deployment\">Canary Deployment<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0432\u044b \u0447\u0438\u0442\u0430\u043b\u0438 <a href=\"https:\/\/habr.com\/en\/company\/nixys\/blog\/512766\/\">\u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c<\/a>, \u0433\u0434\u0435 \u043c\u044b \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u043b\u0438 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Canary deployments \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 Kubernetes.<\/p>\n<p>  <\/p>\n<h3 id=\"istio\">Istio<\/h3>\n<p>  <\/p>\n<p>\u0418 \u043c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u044f \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Istio. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e \u043d\u0435\u043c <a href=\"https:\/\/itnext.io\/kubernetes-istio-simply-visually-explained-58a7d158b83f?source=friends_link&amp;sk=378ed718d2d6cfd09e6d23c7616cba81\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<h3 id=\"prilozhenie-dlya-testov\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/c5\/hl\/ss\/c5hlssnzcdcip4np9vqzvlaketi.png\">  <\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0432\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430: \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 istio-proxy.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0434\u0430\u043c\u0438 frontend-nginx \u0438 backend \u043d\u0430 python. \u041f\u043e\u0434 \u0441 nginx \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u0434 \u0441 backend \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u043e\u043a\u0441\u0438. \u0414\u0435\u0442\u0430\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 yamls:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/gitlab.com\/wuestkamp\/k8s-deployment-example-istio-canary-infrastructure\/blob\/master\/i\/k8s\/frontend.yaml\">frontend.yaml<\/a><\/li>\n<li><a href=\"https:\/\/gitlab.com\/wuestkamp\/k8s-deployment-example-istio-canary-infrastructure\/blob\/master\/i\/k8s\/backend.yaml\">backend.yaml<\/a><\/li>\n<li><a href=\"https:\/\/gitlab.com\/wuestkamp\/k8s-deployment-example-istio-canary-infrastructure\/blob\/master\/i\/k8s\/istio.yaml\">istio.yaml<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h4 id=\"zapusk-testovogo-prilozheniya-samostoyatelno\">\u0417\u0430\u043f\u0443\u0441\u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e<\/h4>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0441\u043c. <a href=\"https:\/\/gitlab.com\/wuestkamp\/k8s-deployment-example-istio-canary-infrastructure\/blob\/master\/README.md\">readme \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a>.<\/p>\n<p>  <\/p>\n<h3 id=\"nachalnyy-deployment\">\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 Deployment<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e Deployment \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u044e\u0442 \u0432\u0441\u0435\u0433\u043e \u043f\u043e 2 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u0442\u043e \u0435\u0441\u0442\u044c Istio sidecar \u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u0442\u0441\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_x\/bo\/rw\/_xborwylalwq7wx17nofd9v6sxy.png\">  <\/p>\n<hr>\n<p>  <\/p>\n<p>\u0418 \u0442\u0430\u043a\u0436\u0435 \u0432\u0438\u0434\u0438\u043c Istio Gateway Loadbalancer \u0432 namespace <code>istio-system<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/m4\/8w\/im\/m48wimqqmkdwgx2r2m8p16_kwc0.png\">  <\/p>\n<h4 id=\"sozdanie-trafika\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/h4>\n<p>  <\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 IP, \u0447\u0442\u043e \u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u044f\u0442 frontend \u043f\u043e\u0434\u0430\u043c\u0438 \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 backend \u043f\u043e\u0434\u044b:<\/p>\n<p>  <\/p>\n<p><code>while true; do curl -s --resolve 'frontend.istio-test:80:35.242.202.152' frontend.istio-test; sleep 0.1; done<\/code><\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c <code>frontend.istio-test<\/code> \u0432 \u043d\u0430\u0448 hosts \u0444\u0430\u0439\u043b.<\/p>\n<p>  <\/p>\n<h4 id=\"prosmotr-mesh-cherez-kiali\">\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 Mesh \u0447\u0435\u0440\u0435\u0437 Kiali<\/h4>\n<p>  <\/p>\n<p>\u041c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 Istio \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Tracing, Grafana, Prometheus \u0438 Kiali (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c. <a href=\"https:\/\/gitlab.com\/wuestkamp\/k8s-deployment-example-istio-canary-infrastructure\/blob\/master\/README.md\">readme \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a>). \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Kiali \u0447\u0435\u0440\u0435\u0437:<\/p>\n<p>  <\/p>\n<p><code>istioctl dashboard kiali # admin:admin<\/code><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ih\/if\/6v\/ihif6vmxgdajbzl67tefasac808.png\">  <\/p>\n<p>Kiali \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u0447\u0435\u0440\u0435\u0437 Mesh<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, 100% \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043d\u0430 frontend service, \u0437\u0430\u0442\u0435\u043c \u043d\u0430 \u043f\u043e\u0434 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0441 label v1, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 nginx-\u043f\u0440\u043e\u043a\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 backend service, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u043d\u0430 backend \u043f\u043e\u0434\u044b \u0441 label v1.<\/p>\n<p>  <\/p>\n<p>Kiali \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Istio \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Mesh. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e.<\/p>\n<p>  <\/p>\n<h3 id=\"canary-deployment-1\">Canary Deployment<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 \u0431\u0435\u043a\u0435\u043d\u0434 \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 k8s deployments, \u043e\u0434\u0438\u043d \u0434\u043b\u044f v1 \u0438 \u043e\u0434\u0438\u043d \u0434\u043b\u044f v2. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c Istio \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 v2. <\/p>\n<p>  <\/p>\n<h3 id=\"shag-1-10\">\u0428\u0430\u0433 1: 10%<\/h3>\n<p>  <\/p>\n<p>\u0418 \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043e\u0442\u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441 VirtualService \u0432 <a href=\"https:\/\/gitlab.com\/wuestkamp\/k8s-deployment-example-istio-canary-infrastructure\/blob\/master\/i\/k8s\/istio.yaml\">istio.yaml<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: networking.istio.io\/v1alpha3 kind: VirtualService metadata:   name: backend   namespace: default spec:   gateways: []   hosts:   - &quot;backend.default.svc.cluster.local&quot;   http:   - match:     - {}     route:     - destination:         host: backend.default.svc.cluster.local         subset: v1         port:           number: 80       weight: 90     - destination:         host: backend.default.svc.cluster.local         subset: v2         port:           number: 80       weight: 10<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sc\/ia\/jo\/sciajo25eqra5sy2a7blayrmmwe.png\">  <\/p>\n<hr>\n<p>  <\/p>\n<p>\u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e 10% \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0430 v2.<\/p>\n<p>  <\/p>\n<h4 id=\"shag-2-50\">\u0428\u0430\u0433 2: 50%<\/h4>\n<p>  <\/p>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0434\u043e 50%:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: networking.istio.io\/v1alpha3 kind: VirtualService metadata:   name: backend   namespace: default spec: ...     - destination:         host: backend.default.svc.cluster.local         subset: v1         port:           number: 80       weight: 50     - destination:         host: backend.default.svc.cluster.local         subset: v2         port:           number: 80       weight: 50<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zp\/z3\/vp\/zpz3vpw19m8lctwrgsclbm6cv-k.png\">  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"shag-3-100\">\u0428\u0430\u0433 3: 100%<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c Canary deployment \u043c\u043e\u0436\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u043c \u0438 \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 v2:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/aj\/4g\/p6\/aj4gp6tjsgle8xvthhqoh7f-6zs.png\">  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"testirovanie-canary-vruchnuyu\">\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Canary \u0432\u0440\u0443\u0447\u043d\u0443\u044e<\/h3>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u0431\u044d\u043a\u044d\u043d\u0434 v2 10% \u043e\u0442 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0427\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c v2, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c?<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043d\u0430 HTTP \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: networking.istio.io\/v1alpha3 kind: VirtualService metadata:   name: backend   namespace: default spec:   gateways: []   hosts:   - &quot;backend.default.svc.cluster.local&quot;   http:   - match:     - headers:         canary:           exact: &quot;canary-tester&quot;     route:     - destination:         host: backend.default.svc.cluster.local         subset: v2         port:           number: 80       weight: 100   - match:     - {}     route:     - destination:         host: backend.default.svc.cluster.local         subset: v1         port:           number: 80       weight: 90     - destination:         host: backend.default.svc.cluster.local         subset: v2         port:           number: 80       weight: 10<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f curl \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c v2 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mh\/x8\/gf\/mhx8gf6jfkuclxq-eycyrswgrks.png\">  <\/p>\n<hr>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u0431\u0435\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435\u043c 1\/10:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6c\/h0\/qt\/6ch0qtr4udeiyvlkkdwvyt0deus.png\">  <\/p>\n<hr>\n<p>  <\/p>\n<h4 id=\"canary-dlya-dvuh-zavisimyh-versiy\">Canary \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439<\/h4>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0433\u0434\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044f v2 \u0438 \u0434\u043b\u044f frontend \u0438 \u0434\u043b\u044f backend. \u0414\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e 10% \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0438\u0434\u0442\u0438 \u043a v2:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/om\/yi\/44\/omyi44n6jle-t2jcfd-7qkfv0mi.png\">  <\/p>\n<hr>\n<p>  <\/p>\n<p>\u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e frontend v1 \u0438 v2 \u043e\u0431\u0430 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u044e\u0442 \u0442\u0440\u0430\u0444\u0438\u043a \u0432 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 1\/10 \u043d\u0430 backend v1 \u0438 v2.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u043d\u0430\u043c \u0431\u044b\u043b\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0441 frontend-v2 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 backend-v2, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 v1? \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c 1\/10 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f frontend, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u043a\u043e\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043d\u0430 backend-v2 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e <code>sourceLabels<\/code> :<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: networking.istio.io\/v1alpha3 kind: VirtualService metadata:   name: backend   namespace: default spec:   gateways: []   hosts:   - &quot;backend.default.svc.cluster.local&quot;   http: ...   - match:     - sourceLabels:         app: frontend         version: v2     route:     - destination:         host: backend.default.svc.cluster.local         subset: v2         port:           number: 80       weight: 100<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gt\/1a\/jd\/gt1ajd9zisxlcxgoukhy_tumxqi.png\">  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"otlichiya-ot-ruchnogo-canary-podhoda\">\u041e\u0442\u043b\u0438\u0447\u0438\u044f \u043e\u0442 \u0440\u0443\u0447\u043d\u043e\u0433\u043e Canary \u043f\u043e\u0434\u0445\u043e\u0434\u0430<\/h3>\n<p>  <\/p>\n<p>\u0412 <em>\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/em> \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438 Canary deployment \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0432\u0430 k8s deployments. \u0422\u0430\u043c \u043c\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u043f\u043b\u0438\u043a. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>Istio \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0435\u043f\u043b\u0438\u043a. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c HPAs (Horizontal Pod Autoscalers \u2014 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u043e\u0432) \u0438 \u0435\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c Canary \u0434\u0435\u043f\u043b\u043e\u044f.<\/p>\n<p>  <\/p>\n<h3 id=\"itog\">\u0418\u0442\u043e\u0433<\/h3>\n<p>  <\/p>\n<p>Istio \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0435\u0433\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Kiali \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u0443\u044e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432 \u043c\u043e\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432 \u044d\u0442\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f Spinnaker \u0441 Istio \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 Canary-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/nixys\/blog\/513578\/\"> https:\/\/habr.com\/ru\/company\/nixys\/blog\/513578\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/nixys\/blog\/513578\/\">\n<h3 id=\"ispolzovanie-istiokiali-dlya-zapuska-i-vizualizacii-canary-deploya\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Istio+Kiali \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Canary \u0434\u0435\u043f\u043b\u043e\u044f<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wk\/ha\/jd\/wkhajdxpv7o_4thn574lsanbzbe.jpeg\">  <\/p>\n<hr>\n<p>  <\/p>\n<h4 id=\"stati-etogo-cikla\">\u0421\u0442\u0430\u0442\u044c\u0438 \u044d\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430<\/h4>\n<p>  <\/p>\n<ol>\n<li><a href=\"https:\/\/habr.com\/en\/company\/nixys\/blog\/512766\/\">Canary Deployment \u0432 Kubernetes #1: Gitlab CI<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/en\/company\/nixys\/blog\/513118\/\">Canary Deployment \u0432 Kubernetes #2: Argo Rollouts<\/a><\/li>\n<li>(\u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f)<\/li>\n<li>Canary Deployment \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Jenkins-X Istio Flagger<\/li>\n<\/ol>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-307909","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=307909"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307909\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}