作者 | 高宇航
职位 | F5 解决方案参谋
在容器技术倒退初期,企业只在开发、测试环境中应用容器。随着容器技术的倒退以及企业对于容器技术的实践和实际的把握逐步加深,企业开始在生产环境中应用容器,应用规模也越来越大。K8S 无疑成为了企业治理容器的首选,作为承载古代利用最重要的基础架构。当利用微服务化后,迁徙至 K8S,开始思考服务如何对外裸露,当然原生的裸露形式有很多,随着各种类型的服务逐步迁徙至 K8S,使用者开始思考入口服务能力的问题,例如,性能问题、稳定性问题、非 HTTP 业务公布问题、七层业务公布能力的问题、安全性问题、高效治理问题等等,随后开始调研企业级入口计划。这篇文章给大家带来的是利用 MSDA 实现 K8S 平台的服务发现。为什么要给大家介绍这种形式呢?第一是想给大家多一种抉择,第二是因为 MSDA 具备他本身的个性,比方轻量化、无摩擦及与平台无关化,看完之后你可能对这些个性会有一个初步的了解。MSDA 是利用 iApp LX 构建了一个模版,应用该模版能够创立一个服务的实例,整个创立过程如下:在 F5 上创立一个服务的资源池 Pool,初始为空;
向 K8S 的 Endpoint 查问指定 Namespace 中指定的 Service 对应的 Pod 的 IP 地址和端口(Endpoint 是实现理论服务的端点的汇合,当 service 创立后会创立一个和 service 同名的 Endpoint 的汇合,当然你须要配置 selector,所以下面我就那么说了,然而这并不是最谨严的说法,为了便于了解);将查问到的 IP 地址和端口增加至创立好的 Pool 中;每隔肯定的周期(可自行定义)查问 Endpoint 中的变动,将变动自动更新到 Pool 中;实例销毁,Pool 和 Member 将主动删除;利用 AS3 创立 Virtual Server 实现服务公布。MSDA 实现 K8S 服务发现的形式有 webui 和 API 两种形式:MSDA 通过 webui 实现服务发现的具体操作步骤如下:01 上传 f5-iapplx-msda-k8s rpm 包至 BIGIP->iApps->Package Management LX->import
02 上传完 RPM 包后会生成一个 Templetes,iApps->Templates->Templates LX
将通用的参数证书、Endpoint 地址等替换成本人环境中的参数并保留。
03 创立一个实例在 iApps->Application Services->Applications LX
抉择模版点击 Next
将 namespace 信息、service name、pool 名称等信息填写好,点击 Deploy
实现创立后,将发现的服务主动增加至 Pool 中
04 删除此实例,须要先将该实例 Undeploy,而后再删除实例
尽管大家看到 webui 的整个实例创立过程非常简单,然而绝大多数使用者更偏向于自动化和 DevOps 的形式来批量创立、销毁实例,所以明天咱们重点来阐明通过 API 的形式部署 MSDA 实现 K8S 上的服务发现。MSDA 通过 API 实现服务发现的具体操作步骤如下:01上传 f5-iapplx-msda-k8s rpm 包至 BIGIP->IApps->Package Management LX->import 如果你违心你也能够用 API 导入。
02创立一个服务的实例 1应用 Postman 创立一个实例
Post 的内容如下,标正文的内容须要批改为你本人定义或者环境的内容
{
“name”:“msdak8s1”,
“inputProperties”: [
{
“id”:“k8sEndpoint”,
“type”:“STRING”,
“value”:“https://192.168.26.31:6443”, #你本人 K8s 环境的 endpoint 地址
"metaData": {
"description": "k8s endpoint",
"displayName": "k8s endpoint",
"isRequired": true
}
},
{
"id": "authenticationCert", #上面的 clientCert、key、CA 须要批改为你本人环境的
"type": "JSON",
"value": {
"clientCert": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJS2F0bDlLalpCaVF3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TVRBMU1EZ3dOak0xTlRKYUZ3MHlNekExTVRJd05ERTNOVFJhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXQ4QlVGdmQ4eDZJRnZZZlEKYW5qTHR3Sjl5eUlPVi9zOUFMakJsSlplaGZidmhnWUtrTUJqMUgwY05NSy8xQWIrSElQQVVWOThjWXNpeGdBWQoxMHVUTitkK2N1WHUrVDljbDBpdkJ1MkEvYW1CT29UTDg3eWNlYjdZZlBEYUxuME9RVH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RWbU0yb0JMZk1vTzFPbzBmbGdUdUQvVFJSWUUraHRLYWM5MWFXMgp0bHVTOTEwVnZrZHMycEV1MS8xSmxDdExJM3ZhZU5yVHY0cndvM2JvbXBRRGlnRzIvbnN3SGdwYzRxZXVNTC9vCkpjUGMrQkgydGw5ZUJsdG9YNFJmaVpsL2JlOXJ4VDY2ZVhTdlZWTVdlZ20zUlJZaDZ1UmZnamZuSmdDZTBoM2cKZVZZcisyOWdscnRDK3ZCeFpHY0w5WkNKVmJPTXgwdXlkMVRmR3V3L1JIWng0NE1OeU1xSmlGSWkwWHpUUU9IVgpPYVNiOHZWc0xDZkMxTnVObVlWMDVUdjQ2RVJMdnlHZzhZZXZyMmc4YUp5MnFrVVk0MGNaZUFoV2dBYWZUZ052CjYrdFluSW4yMjVvek9vWklUWFg1UVkrL3BBcFNpQVF3VzJzNQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="
},
"metaData": {
"description": "k8s lient authentication certificate in base64 encoding",
"displayName": "k8s client certificate",
"isRequired": true
}
},
{
"id": "nameSpace",
"type": "STRING",
"value": "test002", #批改为你本人环境中服务所在的 namespace
“metaData”: {
“description”:“Namespace in kubernetes”,
“displayName”:“Namespace Name in kubernetes”,
“isRequired”: true
}
},
{
“id”:“serviceName”,
“type”:“STRING”,
“value”:“msda1”, #批改为你对应的 Service 名称
"metaData": {
"description": "Service name to be exposed",
"displayName": "Service Name in kubernetes",
"isRequired": true
}
},
{
"id": "poolName",
"type": "STRING",
"value": "/Common/Pool1", #你要创立的 Pool 的名称
“metaData”: {
“description”:“Pool Name to be created”,
“displayName”:“BIG-IP Pool Name”,
“isRequired”: true
}
},
{
“id”:“poolType”,
“type”:“STRING”,
“value”:“round-robin”, #你要抉择的负载平衡算法,请在上面 list 中抉择
"metaData": {
"description": "load-balancing-mode",
"displayName": "Load Balancing Mode",
"isRequired": true,
"uiType": "dropdown",
"uiHints": {
"list": {
"dataList": [
"round-robin",
"least-connections-member",
"least-connections-node"
]
}
}
}
},
{
"id": "healthMonitor",
"type": "STRING",
"value": "http", #抉择你要的健康检查算法,在上面 list 中抉择
"metaData": {
"description": "Health Monitor",
"displayName": "Health Monitor",
"isRequired": true,
"uiType": "dropdown",
"uiHints": {
"list": {
"dataList": [
"tcp",
"udp",
"http",
"none"
]
}
}
}
}
],
"dataProperties": [
{
"id": "pollInterval",
"type": "NUMBER",
"value": 15, #这里是你须要多久去查问一次
“metaData”: {
“description”:“Interval of polling from BIG-IP to registry, 30s by default.”,
“displayName”:“Polling Invertal”,
“isRequired”: false
}
}
],
“configurationProcessorReference”: {
“link”:“https://localhost/mgmt/shared/iapp/processors/msdak8sConfig”
},
“auditProcessorReference”: {
“link”:“https://localhost/mgmt/shared/iapp/processors/msdak8sEnforceConfiguredAudit”
},
“audit”: {
“intervalSeconds”: 60,
“policy”:“ENFORCE_CONFIGURED”
},
“sourcePackage”: {
“packageName”:“f5-iapplx-msda-k8s-0.0.3-0003.noarch”
},
“configProcessorTimeoutSeconds”: 30,
“statsProcessorTimeoutSeconds”: 15,
“configProcessorAffinity”: {
“processorPolicy”:“LOAD_BALANCED”,
“affinityProcessorReference”: {
“link”:“https://localhost/mgmt/shared/iapp/processors/affinity/load-balanced”
}
},
“state”:“BINDING”, #如果你应用的是默认的模版,这里状态改为 BINDING
"generation": 10,
"lastUpdateMicros": 1656552937409259,
"kind": "shared:iapp:blocks:blockstate",
"selfLink": "https://localhost/mgmt/shared/iapp/blocks/b4d1b6ea-30cb-35f9-8704-de9c712d522e"
2F5 上创立了一个新的 Pool 外面并没有 Member(初始状态)
3确认 K8S Service 和 Endpoint 状态
4察看 Pool 外面曾经主动增加了对应的成员
5当 pool 成员发生变化时,会主动增加或者删除池成员扩大 deployment
池成员主动被增加
6应用 AS3 将业务公布
Post 内容如下:
{
"class": "AS3",
"declaration": {
"class": "ADC",
"schemaVersion": "3.1.0",
"id": "urn:uuid:3da22137-87a0-460a-b185-3592d5a13682",
"label": "Converted Declaration",
"remark": "Generated by Automation Config Converter",
"Common": {
"class": "Tenant",
"Shared": {
"class": "Application",
"template": "shared",
"vs1": {
"layer4": "tcp",
"pool": {
"bigip": "/Common/Pool1"
},
"translateServerAddress": true,
"translateServerPort": true,
"class": "Service_TCP",
"profileTCP": {
"bigip": "/Common/tcp"
},
"virtualAddresses": [
"192.168.26.188"
],
"virtualPort": 80,
"snat": "auto"
}
}
}
}
}
察看 Virtual Server 曾经创立实现,关联了方才创立的 Pool,此 API 能够在 Pool 生成后立刻执行,这就是分两段式实现了业务公布。
03
Undeploy 实例要删除实例前必须先 Undeploy 实例,Undeploy 咱们应用 PATCH 办法,Block 前面要加上生成时产生的 id
Post 的数据如下,标正文的内容须要批改
“name”:“msdak8s”,“inputProperties”: [
{“id”:“k8sEndpoint”,“type”:“STRING”,“value”:“https://192.168.26.31:6443”,“metaData”: {“description”:“k8s endpoint”,“displayName”:“k8s endpoint”,“isRequired”: true
}
},
{“id”:“authenticationCert”,“type”:“JSON”,“value”: {“clientCert”:“LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJS2F0bDlLalpCaVF3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TVRBMU1EZ3dOak0xTlRKYUZ3MHlNekExTVRJd05ERTNOVFJhTURReApGekFWQmdOVkJBb1Rebk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXQ4QlVGdmQ4eDZJRnZZZlEKYW5qTHR3Sjl5eUlPVi9zOUFMakJsSlplaGZidmhnWUtrTUJqMUgwY05Nsy8xQWIrSElQQVVWOThjWXNpeGdBWQoxMHVUTitkK2N1WHUrVDljbDBpdkJ1MkEvYW1CT29UTDg3eWNlYjdZZlBEYUxuME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mRWbU0yb0JMZk1vTzFPbzBmbGdUdUQvVFJSWUUraHRLYWM5MWFXMgp0bHVTOTEwVnZrZHMycEV1MS8xSmxDdExJM3ZhZU5yVHY0cndvM2JvbXBRRGlnRzIvbnN3SGdwYzRxZXVNTC9vCkpjUGMrQkgydGw5ZUJsdG9YNFJmaVpsL2JlOXJ4VDY2ZVhTdlZWTVdlZ20zUlJZaDZ1UmZnamZuSmdDZTBoM2cKZVZZcisyOWdscnRDK3ZceFpHY0w5WkNKVmJPTXgwdXlkMVRmR3V3L1JIWng0NE1OeU1xSmlGSWkwWHpUUU9IVgpPYVNiOHZWc0xDZkMxTnVObVlWMDVUdjQ2RVJMdnlHZzhZZXZyMmc4Yup5MnFrVVk0MGNaZUFoV2dBYWZUZ052CjYrdFluSW4yMjVvek9vWklUWFg1UvkrL3BBcFNpQVF3VzJzNQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==”},“metaData”: {“description”:“k8s lient authentication certificate in base64 encoding”,“displayName”:“k8s client certificate”,“isRequired”: true
}
},
{“id”:“nameSpace”,“type”:“STRING”,“value”:“test002”,“metaData”: {“description”:“Namespace in kubernetes”,“displayName”:“Namespace Name in kubernetes”,“isRequired”: true
}
},
{“id”:“serviceName”,“type”:“STRING”,“value”:“msda1”,“metaData”: {“description”:“Service name to be exposed”,“displayName”:“Service Name in kubernetes”,“isRequired”: true
}
},
{“id”:“poolName”,“type”:“STRING”,“value”:“/Common/Pool1”,“metaData”: {“description”:“Pool Name to be created”,“displayName”:“BIG-IP Pool Name”,“isRequired”: true
}
},
{“id”:“poolType”,“type”:“STRING”,“value”:“round-robin”,“metaData”: {“description”:“load-balancing-mode”,“displayName”:“Load Balancing Mode”,“isRequired”: true,“uiType”:“dropdown”,“uiHints”: {“list”: {“dataList”: [“round-robin”,“least-connections-member”,“least-connections-node”]
}
}
}
},
{“id”:“healthMonitor”,“type”:“STRING”,“value”:“http”,“metaData”: {“description”:“Health Monitor”,“displayName”:“Health Monitor”,“isRequired”: true,“uiType”:“dropdown”,“uiHints”: {“list”: {“dataList”: [“tcp”,“udp”,“http”,“none”]
}
}
}
}
],“dataProperties”: [
{“id”:“pollInterval”,“type”:“NUMBER”,“value”: 15,“metaData”: {“description”:“Interval of polling from BIG-IP to registry, 30s by default.”,“displayName”:“Polling Invertal”,“isRequired”: false
}
}
],“configurationProcessorReference”: {“link”:“https://localhost/mgmt/shared/iapp/processors/msdak8sConfig”},“auditProcessorReference”: {“link”:“https://localhost/mgmt/shared/iapp/processors/msdak8sEnforceConfiguredAudit”},“audit”: {“intervalSeconds”: 60,“policy”:“ENFORCE_CONFIGURED”},“sourcePackage”: {“packageName”:“f5-iapplx-msda-k8s-0.0.3-0003.noarch”},“configProcessorTimeoutSeconds”: 30,“statsProcessorTimeoutSeconds”: 15,“configProcessorAffinity”: {“processorPolicy”:“LOAD_BALANCED”,“affinityProcessorReference”: {“link”:“https://localhost/mgmt/shared/iapp/processors/affinity/load-balanced”}
},“state”:“UNBINDING”, #如果你应用的是默认的模版,请将该处改为 UNBINDING
"generation": 11, #这里你须要设置为生成实例 +1
"lastUpdateMicros": 1656552937409259,
"kind": "shared:iapp:blocks:blockstate",
"selfLink": "https://localhost/mgmt/shared/iapp/blocks/b4d1b6ea-30cb-35f9-8704-de9c712d522e"
}
Undeploy 实例后,其实创立的 Pool 曾经被删除了,然而实例并没有被齐全删除,你能够间接部署。请应用 Undeploy 的内容“state”:“UNBINDING”, #将此处改为 BINDING”generation”: 12, #generation 视你以后的操作来确定,如果你写错了,响应会提醒你该写几
04删除一个实例删除一个实例就比较简单了,咱们间接应用 delete 办法在 Block 前面加上 id 即可
以上是通过 MSDA 实现 K8S 环境的服务主动发现的实现过程,如果有了模版,整个过程还是比较简单的,当然全副过程你能够通过 web 界面或者 API 的形式实现,然而更多的可能会想看到自动化运维的实现过程,所以我这里着重阐明了应用 API 的形式去实现。如果各位有趣味本人入手验证,可参考上面的链接以获取相干安装包。收费应用欢送应用下载
免责申明:这些 iAppsLX RPM 软件包并非 F5 公司官网反对的产品,如有任何问题或反馈,请向 GitHub repo 上提交 issue,或发送电子邮件至 msda@f5.com