腾讯合作网站建设有哪些公司,自己的网站做防伪码,盗取wordpress源码,定州市住房和城乡建设局网站背景介绍
针对部署到阿里云ACK集群的应用服务#xff0c;实际业务场景可能需要我们暴露其中的服务到公网并要求通过域名访问改服务#xff0c;那具体在阿里云平台上如何实现呢
配置步骤
新建ack集群是后续工作的第一前提由于篇幅有限就不在本文赘述#xff0c;如下是基本…背景介绍
针对部署到阿里云ACK集群的应用服务实际业务场景可能需要我们暴露其中的服务到公网并要求通过域名访问改服务那具体在阿里云平台上如何实现呢
配置步骤
新建ack集群是后续工作的第一前提由于篇幅有限就不在本文赘述如下是基本准备工作
1、将服务以NodePort方式部署在ACK中
如下图所示为部署的yaml文件
apiVersion: apps/v1
kind: Deployment
metadata:name: test-webnamespace: prod labels:app: test-web
spec:replicas: 1selector:matchLabels:app: test-webtemplate:metadata:labels:app: test-webspec:containers:- name: test-webimage: registry-vpc.cn-shanghai.aliyuncs.com/prod-acr/test-web:${IMAGE-TAG}ports:- containerPort: 8080
# resources:
# limits:
# cpu: 500m
---
apiVersion: v1
kind: Service
metadata:name: test-webnamespace: prod labels:app: test-web
spec:selector:app: test-webports:- name: httpprotocol: TCPport: 80targetPort: 8080- name: httpsprotocol: TCPport: 443targetPort: 8080type: NodePort2、配置AlbConfig
如下图所示在工作负载-自定义资源中添加AlbConfig
apiVersion: alibabacloud.com/v1
kind: AlbConfig
metadata:name: test-prod-albannotations:kubectl.kubernetes.io/last-applied-configuration: {apiVersion:alibabacloud.com/v1,kind:AlbConfig,metadata:{annotations:{},name:test-prod-alb},spec:{config:{addressType:Internet,id:alb-dgggggggsaaayy7,name:test-prod-alb,zoneMappings:[{vSwitchId:vsw-xxxxxyyyyyyyyg},{vSwitchId:vsw-xxxxxxxyyyyhib}]},listeners:[{port:80,protocol:HTTP},{port:443,protocol:HTTPS}]}}
spec:config:addressType: InternetforceOverride: trueid: alb-dgggggggsaaayy7listenerForceOverride: truename: test-prod-albzoneMappings:- vSwitchId: vsw-xxxxxyyyyyyyyg- vSwitchId: vsw-xxxxxxxyyyyhiblisteners:- port: 80protocol: HTTP- port: 443protocol: HTTPS
其中config.id代表是已有的ALB实例的IDconfig.name则可以自定义config.forceOverride为true则会强制替换已有的ALB实例的配置zoneMappings.vSwitchId表示vpc网络的交换机的实例id
3、新建IngressClass
如下图所示在工作负载-自定义资源中添加IngressClass
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:name: alb
spec:controller: ingress.k8s.alibabacloud/albparameters:apiGroup: alibabacloud.comkind: AlbConfigname: test-prod-albscope: Cluster
4、配置证书密钥
如下图所示,在配置管理-保密字典中创建 点击创建按钮如下图所示 其中TLS证书在后面的步骤中会提到如何新建SSL证书在SSL证书平台中下载对应的证书如下图所示 点击【下载】按钮打开如下图所示页面 下载之后获取证书和key文件如下图所示
5.新建Ingress路由配置
在网络-路由中创建Ingress 点击【创建Ingress】如下图所示 以上操作就会自动把SSL证书挂载到对应的ALB实例下
6、申请SSL证书 此步骤确定之后需要提交审核免费证书通过审核要10几分钟审核通过之后在SSL证书域名解析记录中会出现如下图所示的TXT类型的记录
7、添加域名解析
如下步骤则是将域名挂载到已有的ALB实例的动作