其他
洛神云网络集中式网关ACMG最佳实践
云布道师
集中式网关和 Sidecar、Ambient 有什么区别?
集中式网关的转发底座是什么?
集中式网关适合哪种业务使用?
集中式网关打算一直坚持开源吗?
编译代码
$ make build
编译镜像
$ make docker
$ docker images
localhost:5000/app_sidecar_centos_7 latest
localhost:5000/app_sidecar_debian_11 latest
localhost:5000/app_sidecar_ubuntu_xenial latest
localhost:5000/app_sidecar_ubuntu_jammy latest
localhost:5000/app latest
localhost:5000/install-cni latest
localhost:5000/proxyv2 latest
localhost:5000/operator latest
localhost:5000/pilot latest
localhost:5000/istioctl latest
localhost:5000/acmg latest
localhost:5000/ext-authz latest
安装
$ ./out/linux_amd64/istioctl profile list
Istio configuration profiles:
acmg
default
demo
empty
external
minimal
openshift
preview
$ ./out/linux_amd64/istioctl install --set profile=acmg
$ kubectl get pods -n istio-system
NAME READY STATUS RESTARTS AGE
acmg-controller-798cbd6b9d-x4fmd 1/1 Running 0 5m32s
acmg-gateway-66f9f86fcd-xx9qg 1/1 Running 0 3m8s
istiod-945b9f699-sm4js 1/1 Running 0 5m31s
使用
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: helloworld-acmg
namespace: istio-system
spec:
enableAcmg: true
hosts:
- "*"
http:
- match:
- uri:
exact: /hello
route:
- destination:
host: helloworld.default.svc.cluster.local
卸载
$ ./out/linux_amd64/istioctl uninstall --purge
$ kubectl get pods -n istio-system
No resources found.
可以看到,集中式网关的相关资源已经全部清理完毕。
流量分发
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: helloworld-acmg
namespace: istio-system
spec:
host: helloworld.default.svc.cluster.local
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: helloworld-acmg
namespace: istio-system
spec:
enableAcmg: true
hosts:
- "*"
http:
- match:
- uri:
exact: /hello
route:
- destination:
host: helloworld.default.svc.cluster.local
subset: v1
weight: 90
- destination:
host: helloworld.default.svc.cluster.local
subset: v2
weight: 10
故障注入
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: helloworld-acmg
namespace: istio-system
spec:
enableAcmg: true
hosts:
- "*"
http:
- fault:
delay:
percentage:
value: 0.1
fixedDelay: 5s
- match:
- uri:
exact: /hello
route:
- destination:
host: helloworld.default.svc.cluster.local
服务熔断
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: helloworld-acmg
namespace: istio-system
spec:
host: helloworld.default.svc.cluster.local
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN
subsets:
- name: v1
labels:
version: v1
trafficPolicy:
connectionPool:
tcp:
maxConnections: 100
- name: v2
labels:
version: v2
开源代码链接:
你可能还想看