This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
стратегии_деплоя_в_kubernetes [2025/02/26 08:59] val [Шаг 6. canary deployment with Istio VirtualService] |
стратегии_деплоя_в_kubernetes [2026/04/05 12:01] (current) val [Пример Gateway] |
||
|---|---|---|---|
| Line 17: | Line 17: | ||
| ===== Запись вебинара ===== | ===== Запись вебинара ===== | ||
| - | * Тэги: | + | * Тэги: deployment rollout, canary deployment, ingress annotations, Kubernetes Gateway API, Istio Service Mesh, kiali, nginx proxy header |
| + | * https://rutube.ru/video/private/45160ea603c4f541cd11ebcc3fdf5109/ | ||
| + | * https://youtu.be/uEpEDk8EWSg | ||
| ===== Методическая подготовка ===== | ===== Методическая подготовка ===== | ||
| - | ==== В паузах рассказать про ==== | ||
| - | |||
| - | * | ||
| ===== Шаг 1. Что у нас есть для начала ===== | ===== Шаг 1. Что у нас есть для начала ===== | ||
| Line 214: | Line 213: | ||
| <code> | <code> | ||
| kube1# kubectl delete -f my-webd-ingress-and-canary.yaml -n my-ns | kube1# kubectl delete -f my-webd-ingress-and-canary.yaml -n my-ns | ||
| + | </code> | ||
| + | ==== Установка gateway-api crd ==== | ||
| + | <code> | ||
| kube1# kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd?ref=v1.2.0" | kubectl apply -f - | kube1# kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd?ref=v1.2.0" | kubectl apply -f - | ||
| </code> | </code> | ||
| - | * [[Система Kubernetes#MetalLB]] с autoAssign: true | ||
| + | |||
| + | ==== Установка Istio ==== | ||
| + | |||
| + | * [[Система Kubernetes#MetalLB]] с autoAssign: true | ||
| <code> | <code> | ||
| kube1# curl -L https://istio.io/downloadIstio | sh - | kube1# curl -L https://istio.io/downloadIstio | sh - | ||
| Line 226: | Line 231: | ||
| kube1# istioctl install | kube1# istioctl install | ||
| + | </code> | ||
| - | kube1# cat my-webd-gateway.yaml | + | * Если [[Система Kubernetes#MetalLB]] с autoAssign: false |
| + | |||
| + | <code> | ||
| + | kubectl -n istio-system edit service istio-ingressgateway | ||
| + | </code><code> | ||
| + | ... | ||
| + | kind: Service | ||
| + | metadata: | ||
| + | annotations: | ||
| + | metallb.universe.tf/ip-allocated-from-pool: first-pool | ||
| + | metallb.universe.tf/loadBalancerIPs: 192.168.X.Y | ||
| + | ... | ||
| + | </code> | ||
| + | ==== Пример Gateway ==== | ||
| + | <code> | ||
| + | kube1# cat my-gateway.yaml | ||
| </code><code> | </code><code> | ||
| apiVersion: gateway.networking.k8s.io/v1 | apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | kind: Gateway | ||
| metadata: | metadata: | ||
| - | name: my-webd-gateway | + | name: my-gateway |
| spec: | spec: | ||
| gatewayClassName: istio | gatewayClassName: istio | ||
| Line 243: | Line 264: | ||
| from: Same | from: Same | ||
| </code><code> | </code><code> | ||
| - | kube1# kubectl -n my-ns apply -f my-webd-gateway.yaml | + | kube1# kubectl -n my-ns apply -f my-gateway.yaml |
| - | kube1# kubectl -n my-ns get gtw my-webd-gateway | + | kube1# kubectl -n my-ns get gtw my-gateway |
| - | my-webd-gateway istio 192.168.13.66 True 113m | + | my-gateway istio 192.168.13.66 True 113m |
| + | </code> | ||
| - | kube1# cat my-webd-route.yaml | + | |
| + | * Если [[Система Kubernetes#MetalLB]] с autoAssign: false | ||
| + | |||
| + | <code> | ||
| + | kubectl patch svc my-gateway-istio -n my-ns -p '{"metadata":{"annotations":{"metallb.universe.tf/loadBalancerIPs":"192.168.X.N"}}}' | ||
| + | </code> | ||
| + | ==== Пример HTTPRoute ==== | ||
| + | <code> | ||
| + | kube1# cat my-httproute.yaml | ||
| </code><code> | </code><code> | ||
| apiVersion: gateway.networking.k8s.io/v1 | apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | kind: HTTPRoute | ||
| metadata: | metadata: | ||
| - | name: my-webd-route | + | name: my-httproute |
| spec: | spec: | ||
| parentRefs: | parentRefs: | ||
| - | - name: my-webd-gateway | + | - name: my-gateway |
| rules: | rules: | ||
| - matches: | - matches: | ||
| Line 270: | Line 300: | ||
| weight: 10 | weight: 10 | ||
| </code><code> | </code><code> | ||
| - | kube1# kubectl -n my-ns apply -f my-webd-route.yaml | + | kube1# kubectl -n my-ns apply -f my-httproute.yaml |
| - | kube1# kubectl -n my-ns describe httproutes.gateway.networking.k8s.io my-webd-route | + | kube1# kubectl -n my-ns describe httproutes.gateway.networking.k8s.io my-httproute |
| - | kube1# IP=$(kubectl -n my-ns get gtw my-webd-gateway -ojsonpath='{.status.addresses[0].value}') | + | kube1# IP=$(kubectl -n my-ns get gtw my-gateway -ojsonpath='{.status.addresses[0].value}') |
| kube1# while true; do curl $IP; sleep 0.1; done | kube1# while true; do curl $IP; sleep 0.1; done | ||
| Line 379: | Line 409: | ||
| kind: Gateway | kind: Gateway | ||
| metadata: | metadata: | ||
| - | name: my-webd-gateway | + | name: my-gateway |
| spec: | spec: | ||
| selector: | selector: | ||
| Line 423: | Line 453: | ||
| - "gowebd.corp13.un" | - "gowebd.corp13.un" | ||
| gateways: | gateways: | ||
| - | - my-webd-gateway | + | - my-gateway |
| http: | http: | ||
| # - name: "canary" | # - name: "canary" | ||
| Line 616: | Line 646: | ||
| kube1# while true; do curl 192.168.13.65 -H "Host: gowebd.corp13.un"; sleep 0.1; done | kube1# while true; do curl 192.168.13.65 -H "Host: gowebd.corp13.un"; sleep 0.1; done | ||
| </code> | </code> | ||
| + | |||
| + | ==== Добавление журналов ==== | ||
| * [[https://istio.io/latest/docs/tasks/observability/logs/access-log/|Envoy Access Logs ... Default access log format]] | * [[https://istio.io/latest/docs/tasks/observability/logs/access-log/|Envoy Access Logs ... Default access log format]] | ||