首页 > 其他分享 >workloadentry详解

workloadentry详解

时间:2022-12-16 19:01:45浏览次数:64  
标签:name locality mongodb labels istio yamlapiVersion 详解 workloadentry


欢迎关注我的公众号:

workloadentry详解_ide

 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:

​istio多集群探秘,部署了50次多集群后我得出的结论​

​istio多集群链路追踪,附实操视频​

​istio防故障利器,你知道几个,istio新手不要读,太难!​

​istio业务权限控制,原来可以这么玩​

​istio实现非侵入压缩,微服务之间如何实现压缩​

​不懂envoyfilter也敢说精通istio系列-http-rbac-不要只会用AuthorizationPolicy配置权限​

​不懂envoyfilter也敢说精通istio系列-02-http-corsFilter-不要只会vs​

​不懂envoyfilter也敢说精通istio系列-03-http-csrf filter-再也不用再代码里写csrf逻辑了​

​不懂envoyfilter也敢说精通istio系列http-jwt_authn-不要只会RequestAuthorization​

​不懂envoyfilter也敢说精通istio系列-05-fault-filter-故障注入不止是vs​

​不懂envoyfilter也敢说精通istio系列-06-http-match-配置路由不只是vs​

​不懂envoyfilter也敢说精通istio系列-07-负载均衡配置不止是dr​

​不懂envoyfilter也敢说精通istio系列-08-连接池和断路器​

​不懂envoyfilter也敢说精通istio系列-09-http-route filter​

​不懂envoyfilter也敢说精通istio系列-network filter-redis proxy​

​不懂envoyfilter也敢说精通istio系列-network filter-HttpConnectionManager​

​不懂envoyfilter也敢说精通istio系列-ratelimit-istio ratelimit完全手册​

学习目标

workloadentry详解_mongodb_02

什么是WorkloadEntry

​WorkloadEntry​​​ enables operators to describe the properties of a single non-Kubernetes workload such as a VM or a bare metal server as it is onboarded into the mesh. A ​​WorkloadEntry​​​ must be accompanied by an Istio ​​ServiceEntry​​​ that selects the workload through the appropriate labels and provides the service definition for a ​​MESH_INTERNAL​​​ service (hostnames, port properties, etc.). A ​​ServiceEntry​​ object can select multiple workload entries as well as Kubernetes pods based on the label selector specified in the service entry.

资源详解

Field

Type

Description

Required

​address​

​string​

Address associated with the network endpoint without the port. Domain names can be used if and only if the resolution is set to DNS, and must be fully-qualified without wildcards. Use the form unix:///absolute/path/to/socket for Unix domain socket endpoints.

Yes

​ports​

​map​

Set of ports associated with the endpoint. If the port map is specified, it must be a map of servicePortName to this endpoint’s port, such that traffic to the service port will be forwarded to the endpoint port that maps to the service’s portName. If omitted, and the targetPort is specified as part of the service’s port specification, traffic to the service port will be forwarded to one of the endpoints on the specified ​​targetPort​​. If both the targetPort and endpoint’s port map are not specified, traffic to a service port will be forwarded to one of the endpoints on the same port.NOTE 1: Do not use for ​​unix://​​ addresses.NOTE 2: endpoint port map takes precedence over targetPort.

No

​labels​

​map​

One or more labels associated with the endpoint.

No

​network​

​string​

Network enables Istio to group endpoints resident in the same L3 domain/network. All endpoints in the same network are assumed to be directly reachable from one another. When endpoints in different networks cannot reach each other directly, an Istio Gateway can be used to establish connectivity (usually using the ​​AUTO_PASSTHROUGH​​ mode in a Gateway Server). This is an advanced configuration used typically for spanning an Istio mesh over multiple clusters.

No

​locality​

​string​

The locality associated with the endpoint. A locality corresponds to a failure domain (e.g., country/region/zone). Arbitrary failure domain hierarchies can be represented by separating each encapsulating failure domain by /. For example, the locality of an an endpoint in US, in US-East-1 region, within availability zone az-1, in data center rack r11 can be represented as us/us-east-1/az-1/r11. Istio will configure the sidecar to route to endpoints within the same locality as the sidecar. If none of the endpoints in the locality are available, endpoints parent locality (but within the same network ID) will be chosen. For example, if there are two endpoints in same network (networkID “n1”), say e1 with locality us/us-east-1/az-1/r11 and e2 with locality us/us-east-1/az-2/r12, a sidecar from us/us-east-1/az-1/r11 locality will prefer e1 from the same locality over e2 from a different locality. Endpoint e2 could be the IP associated with a gateway (that bridges networks n1 and n2), or the IP associated with a standard service endpoint.

No

​weight​

​uint32​

The load balancing weight associated with the endpoint. Endpoints with higher weights will receive proportionally higher traffic.

No

​serviceAccount​

​string​

The service account associated with the workload if a sidecar is present in the workload. The service account must be present in the same namespace as the configuration ( WorkloadEntry or a ServiceEntry)

address

wle-mongodb-address.yaml

apiVersion: networking.istio.io/v1beta1
kind: WorkloadEntry
metadata:
name: mongo-wle
spec:
address: 192.168.198.154
labels:
app: mongodb
instance-id: vm1

se-mongodb.yaml

apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: mongodb-se
spec:
hosts:
- mongodb.vm.demo
addresses:
- 192.168.198.177
location: MESH_INTERNAL
ports:
- number: 27017
name: tcp
protocol: TCP
targetPort: 27017
resolution: STATIC
workloadSelector:
labels:
app: mongodb
instance-id: vm1

labels

wle-mongodb-labels.yaml

apiVersion: networking.istio.io/v1beta1
kind: WorkloadEntry
metadata:
name: mongo-wle
spec:
address: 192.168.198.154
labels:
app: mongodb
instance-id: vm1

locality

wle-mongodb-locality-01.yaml

apiVersion: networking.istio.io/v1beta1
kind: WorkloadEntry
metadata:
name: mongo-wle-01
spec:
address: 192.168.198.154
labels:
app: mongodb
instance-id: vm1
type: vm
locality: "us-central1/z1/sz01"

wle-mongodb-locality-02.yaml

apiVersion: networking.istio.io/v1beta1
kind: WorkloadEntry
metadata:
name: mongo-wle-02
spec:
address: 192.168.198.155
labels:
app: mongodb
instance-id: vm1
type: vm
locality: "us-central2/z2/sz02"

se-mongodb-locality.yaml

apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: mongodb-se
spec:
hosts:
- mongodb.vm.demo
addresses:
- 192.168.198.177
location: MESH_INTERNAL
ports:
- number: 27017
name: tcp
protocol: TCP
targetPort: 27017
resolution: STATIC
workloadSelector:
labels:
app: mongodb
type: vm

dr-mongodb-locality-failover.yaml

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: dr-mongodb
spec:
host: mongodb.vm.demo
trafficPolicy:
loadBalancer:
consistentHash:
useSourceIp: true
localityLbSetting:
enabled: true
failover:
- from: us-central1/z1/sz01
to: us-central2/z2/sz02
- from: us-central2/z2/sz02
to: us-central1/z1/sz01
outlierDetection:
consecutive5xxErrors: 1
interval: 1s
baseEjectionTime: 1m

network

network和多集群有关

wle-mongodb-network.yaml

apiVersion: networking.istio.io/v1beta1
kind: WorkloadEntry
metadata:
name: mongo-wle
spec:
address: 192.168.198.154
labels:
app: mongodb
instance-id: vm1
type: vm
network: n1

ports

wle-mongodb-ports.yaml

apiVersion: networking.istio.io/v1beta1
kind: WorkloadEntry
metadata:
name: mongo-wle
spec:
address: 192.168.198.154
ports:
mongodb: 27017
labels:
app: mongodb
instance-id: vm1
type: vm

serviceAccount

wle-mongodb-serviceAccount.yaml

apiVersion: networking.istio.io/v1beta1
kind: WorkloadEntry
metadata:
name: mongo-wle
spec:
serviceAccount: mongodb-vm
address: 192.168.198.154
ports:
mongodb: 27017
labels:
app: mongodb
instance-id: vm1
type: vm

加了serviceaccount访问不了

虚拟机上必须安装sidecar

将在workloadGroup中进行介绍

weight

wle-mongodb-weight-01.yaml

apiVersion: networking.istio.io/v1beta1
kind: WorkloadEntry
metadata:
name: mongo-wle-01
spec:
weight: 20
address: 192.168.198.154
ports:
mongodb: 27017
labels:
app: mongodb
instance-id: vm1
type: vm

wle-mongodb-weight-02.yaml

apiVersion: networking.istio.io/v1beta1
kind: WorkloadEntry
metadata:
name: mongo-wle-02
spec:
weight: 80
address: 192.168.198.155
ports:
mongodb: 27017
labels:
app: mongodb
instance-id: vm2
type: vm

se-mongodb.yaml

apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: mongodb-se
spec:
hosts:
- mongodb.vm.demo
addresses:
- 192.168.198.177
location: MESH_INTERNAL
ports:
- number: 27017
name: tcp
protocol: TCP
targetPort: 27017
resolution: STATIC
workloadSelector:
labels:
app: mongodb
type: vm

dr-mongodb.yaml

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: dr-mongodb
spec:
host: mongodb.vm.demo
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN

标签:name,locality,mongodb,labels,istio,yamlapiVersion,详解,workloadentry
From: https://blog.51cto.com/u_11979904/5948170

相关文章

  • PeerAuthentication详解
     欢迎关注我的公众号: 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:​​istio多集群探秘,部署了50次多集群后我得出的结论​​​​istio多集群链路追踪,附实操视频​......
  • requestAuthentication详解
     欢迎关注我的公众号: 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:​​istio多集群探秘,部署了50次多集群后我得出的结论​​​​istio多集群链路追踪,附实操视频​......
  • sidecar详解
     欢迎关注我的公众号: 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:​​istio多集群探秘,部署了50次多集群后我得出的结论​​​​istio多集群链路追踪,附实操视频​......
  • C#高级--Expression详解
    C#高级–Expression详解零、文章目录一、Expression是什么1、如何定义Expression<Func<TSource,bool>>就是表达式目录树Expression不能带有大括号,只能有一行代码2、和委托......
  • Hubbell EDI 855 采购订单确认报文详解
    Hubbell于纽约证券交易所上市,全球员工近12000名,在欧美地区以其高品质获得人们的青睐,成为家喻户晓的品牌,同类产品占有份额达95%以上。在数字化的今天,HUBBELL延续了在一个......
  • JavaScript中this关键字使用方法详解
       在面向对象编程语言中,对于this关键字我们是非常熟悉的。比如C++、C#和Java等都提供了这个关键字,虽然在开始学习的时候觉得比较难,但只要理解了,用起来是非常方便和意义......
  • Mysql主从复制详解
    目的:主从服务器设置的稳健性得以提升,如果主服务器发生故障,可以把本来作为备份的从服务器提升为新的主服务器。在主从服务器上分开处理用户的请求,可获得更短的响应时间。用从......
  • django数据模型db_constraint的使用详解
    ManyToMany参数((through,db_constraint))classBook(models.Model):name=models.CharField(max_length=20)authors=models.ManyToMany('Author',through='Score')......
  • [JVM]深入类加载机制详解
    如下图所示,JVM类加载机制分为五个部分:加载,验证,准备,解析,初始化,下面我们就分别来看一下这五个过程。​​​​加载加载是类加载过程中的一个阶段,这个阶段会在内存中生成一个代......
  • cs61abc分享会(六)程序的输入输出详解 - 标准输入输出,文件,设备,EOF,命令行参数
    系列文章目录分享会链接2022年7月23日分享会长期链接:https://meeting.tencent.com/dm/Qet4sVXmOccd分享时间:9点20到9点50视频录播在最下方文章目录​​系列文章目录​​​......