本小节主要讲解针对连接、请求、和异常点检测如何配置断路器。
断路是创建弹性微服务应用程序的重要模式,断路允许您编写应用程序来限制故障,延迟峰值和网络特性的其他不良影响的影响。
一.准备工作
清除之前的规则
[root@k8s-master01 httpbin]# kubectl delete -f ../../samples/bookinfo/networking/virtual-service-all-v1.yaml -n istio
virtualservice.networking.istio.io "productpage" deleted
virtualservice.networking.istio.io "reviews" deleted
virtualservice.networking.istio.io "ratings" deleted
virtualservice.networking.istio.io "details" deleted
1.本环境假定已经开启了sidecar注入,部署httpbin服务。
root@k8s-master01 httpbin]# vim httpbin.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpbin
spec:
replicas: 1
selector:
matchLabels:
app: httpbin
version: v1
template:
metadata:
labels:
app: httpbin
version: v1
spec:
serviceAccountName: httpbin
containers:
- image: docker.io/kennethreitz/httpbin
imagePullPolicy: IfNotPresent
name: httpbin
ports:
- containerPort: 80
[root@k8s-master01 httpbin]# kubectl apply -f httpbin.yaml -n istio
serviceaccount/httpbin created
service/httpbin created
deployment.apps/httpbin created
[root@k8s-master01 httpbin]#
[root@k8s-master01 httpbin]#
二:配置断路器
1.当调用httpbin服务时,创建destination rule去应用断路器。
标签:networking,istio,断路器,io,httpbin,k8s,root From: https://www.cnblogs.com/fenghua001/p/17415814.html