当前位置: 首页 > news >正文

有什么网站图片可以做图片合成沈阳seo排名收费

有什么网站图片可以做图片合成,沈阳seo排名收费,卖汽车的网站怎么做的吗,做网站专题的软件问题 我需要在k8s集群里面部署springboot服务,通过k8s ingress访问集群内部的springboot服务,应该怎么做? 这里假设已经准备好k8s集群,而且也准备好springboot服务的运行镜像了。这里我们将精力放在k8s服务编排上面。 一图胜千言…

问题

我需要在k8s集群里面部署springboot服务,通过k8s ingress访问集群内部的springboot服务,应该怎么做?
这里假设已经准备好k8s集群,而且也准备好springboot服务的运行镜像了。这里我们将精力放在k8s服务编排上面。

一图胜千言

ingress最简扇出模式
上图来自于kubernetes的ingress教程。接下来,我们按照上述部署1个ingress+2个服务。

service1

先用kubectl命令创建一个deployment.yaml和service.yaml,然后,将这两个内容合并到一个文件中,即service1.yaml。具体命令如下:
创建deployment.yaml:

kubectl create deployment service1 --image xxx.dkr.ecr.us-east-1.amazonaws.com/service1:latest -o yaml --dry-run=client > k8s/deployment.yaml 

创建service.yaml:

 kubectl create service clusterip service1 --tcp 8080:8080 -o yaml --dry-run=client > k8s/service.yaml 

根据自己需求,去掉一下不要的内容,调整相关配置,合并成如下内容:

service1.yaml

apiVersion: apps/v1
kind: Deployment
metadata:labels:app: service1name: service1
spec:replicas: 2selector:matchLabels:app: service1template:metadata:labels:app: service1spec:containers:- image: xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/service1:latestname: service1resources:requests:memory: "2Gi"cpu: "2"limits:memory: "2Gi"cpu: "2"# 准备检查,通过则接入流量readinessProbe:httpGet:path: /foo/actuator/healthport: 8080# 活力检查,不通过时重启容器livenessProbe:httpGet:path: /foo/actuator/healthport: 8080
---
apiVersion: v1
kind: Service
metadata:labels:app: service1name: service1
spec:ports:- name: httpport: 4200targetPort: 4200selector:app: service1type: ClusterIP

service2

按之前service1方式,获得如下内容:

service2.yaml

apiVersion: apps/v1
kind: Deployment
metadata:labels:app: service2name: service2
spec:replicas: 2selector:matchLabels:app: service2template:metadata:labels:app: service2spec:containers:- image: xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/service2:latestname: service2resources:requests:memory: "2Gi"cpu: "2"limits:memory: "2Gi"cpu: "2"# 准备检查,通过则接入流量readinessProbe:httpGet:path: /bar/actuator/healthport: 8080# 活力检查,不通过时重启容器livenessProbe:httpGet:path: /bar/actuator/healthport: 8080
---
apiVersion: v1
kind: Service
metadata:labels:app: service2name: service2
spec:ports:- name: httpport: 8080targetPort: 8080selector:app: service2type: ClusterIP

ingress

使用kubectl命令获得ingress基本配置,如下命令:

kubectl create ingress ingress --rule="/path=service1:8080" -o yaml --dry-run=client > k8s/ingress.yaml

根据自己的需求调整后的内容如下:

ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:name: ingress
spec:rules:- http:paths:- backend:service:name: service1port:number: 4200path: /foopathType: Prefix- backend:service:name: service2port:number: 8080path: /barpathType: Prefix

这里有个问题,由于我现在使用的aws云,所以,这k8s ingress在aws云环境下面,需要针对这种情况调整aws云相关配置。

AWS EKS配置AWS Load Balancer Controller

为集群创建 IAM OIDC 提供商

找到现有集群的OpenID Connect 提供商 URL值,点击copy,如下图:
复制集群的OpenID
然后,回到IAM主页,为集群创建 IAM OIDC 提供商,具体如下:
添加提供商
创建提供商如下图:
创建身份提供商

AWS Load Balancer Controller 部署到EKS
创建AWSLoadBalancerControllerIAMPolicy策略

我这里用到aws云区是普通云区,所以,这里使用的aws-load-balancer-controller的策略脚本如下:
https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/main/docs/install/iam_policy.json
下载命令如下:

curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/main/docs/install/iam_policy.json

新建一个策略:

aws iam create-policy \--policy-name AWSLoadBalancerControllerIAMPolicy \--policy-document file://iam-policy.json
创建一个ServiceAccount给k8s
eksctl create iamserviceaccount \
--cluster=<cluster-name> \
--namespace=kube-system \
--name=aws-load-balancer-controller \
--attach-policy-arn=arn:aws:iam::<AWS_ACCOUNT_ID>:policy/AWSLoadBalancerControllerIAMPolicy \
--override-existing-serviceaccounts \
--region <region-code> \
--approve

这里用到eksctl命令,给k8s集群创建一个ServiceAccount服务账号aws-load-balancer-controller,并使用上面之前创建的权限策略。怎么安装eksctl命令,可以看看官网,这里就不提了。

helm安装aws-load-balancer-controller

这里假设我们已经会使用k8s集群的包管理器helm了。
添加EKS资源库到helm,如下命令:

helm repo add eks https://aws.github.io/eks-charts

更新本地资源库,如下命令:

helm repo update eks

安装aws-load-balancer-controller,如下命令:

helm install aws-load-balancer-controller eks/aws-load-balancer-controller --set clusterName=my-cluster -n kube-system --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller

等待一段时间出现,如下反馈,说明aws-load-balancer-controller安装成功:

NAME: aws-load-balancer-controller
LAST DEPLOYED: Thu Mar  7 15:11:01 2024
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
AWS Load Balancer controller installed!

如果出现,如下错误:
Error: INSTALLATION FAILED: cannot re-use a name that is still in use
说明,需要先卸载,再安装,具体命令如下:

helm delete aws-load-balancer-controller -n kube-system

检查k8s集群中aws-load-balancer-controller是否安装成功,具体命令如下:

kubectl get deployment -n kube-system aws-load-balancer-controller

安装成功示例,如下:

NAME                           READY   UP-TO-DATE   AVAILABLE   AGE
aws-load-balancer-controller   2/2     2            2           10m

调整ingress配置

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:name: ingressannotations:# alb名称alb.ingress.kubernetes.io/load-balancer-name: apg2# 内网alb.ingress.kubernetes.io/scheme: internal# 流量路由到pod层面alb.ingress.kubernetes.io/target-type: ip
spec:# 使用alb作为ingress默认类ingressClassName: albrules:- http:paths:- backend:service:name: service1port:number: 4200path: /foopathType: Prefix- backend:service:name: service2port:number: 8080path: /barpathType: Prefix

调整service配置

除了再ingress里面添加lbc注解之外,还需要再service中添加健康检查的lbc注解:

  annotations:alb.ingress.kubernetes.io/healthcheck-path: /api/demo/actuator/health
service1.yaml
apiVersion: apps/v1
kind: Deployment
metadata:labels:app: service1name: service1
spec:replicas: 2selector:matchLabels:app: service1template:metadata:labels:app: service1spec:containers:- image: xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/service1:latestname: service1resources:requests:memory: "2Gi"cpu: "2"limits:memory: "2Gi"cpu: "2"# 准备检查,通过则接入流量readinessProbe:httpGet:path: /foo/actuator/healthport: 8080# 活力检查,不通过时重启容器livenessProbe:httpGet:path: /foo/actuator/healthport: 8080
---
apiVersion: v1
kind: Service
metadata:labels:app: service1name: service1annotations:# aws目标组健康检查alb.ingress.kubernetes.io/healthcheck-path: /for/actuator/health
spec:ports:- name: httpport: 4200targetPort: 4200selector:app: service1type: ClusterIP
service2.yaml
apiVersion: apps/v1
kind: Deployment
metadata:labels:app: service2name: service2
spec:replicas: 2selector:matchLabels:app: service2template:metadata:labels:app: service2spec:containers:- image: xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/service2:latestname: service2resources:requests:memory: "2Gi"cpu: "2"limits:memory: "2Gi"cpu: "2"# 准备检查,通过则接入流量readinessProbe:httpGet:path: /bar/actuator/healthport: 8080# 活力检查,不通过时重启容器livenessProbe:httpGet:path: /bar/actuator/healthport: 8080
---
apiVersion: v1
kind: Service
metadata:labels:app: service2name: service2annotations:# aws目标组健康检查alb.ingress.kubernetes.io/healthcheck-path: /bar/actuator/health
spec:ports:- name: httpport: 8080targetPort: 8080selector:app: service2type: ClusterIP

部署

kubectl apply -f ./k8s

清除资源:

kubectl delete -f ./k8s

总结

AWS Load Balancer Controller没有重写路径功能,注意安全。这里只介绍的主要是EKS创建ALB在私有VPC内部访问。这里没有介绍CDN套在API接口外面的情况,一般来说,预算足够的情况下面,都会在API接口外面套一层CDN服务。需要注意的是AWS CloudFront(CDN服务)只支持公网的LB。不知道什么原因维护AWS Load Balancer Controller(LBC)团队的人,死活不肯提供重写路径功能。这里还没有服务监控,有机会再介绍介绍吧!
下面是公有ingress创建ALB的配置:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:name: ingressannotations:# alb名称alb.ingress.kubernetes.io/load-balancer-name: apg2# 只让cdn(CloudFront)访问负载均衡器alb.ingress.kubernetes.io/security-groups: cloudfront-only# pod和node安全组自动生成alb.ingress.kubernetes.io/manage-backend-security-group-rules: "true"# 公网alb.ingress.kubernetes.io/scheme: internet-facing# 流量路由到pod层面alb.ingress.kubernetes.io/target-type: ip
spec:# 使用alb作为ingress默认类ingressClassName: albrules:- http:paths:- backend:service:name: service1port:number: 4200path: /foopathType: Prefix- backend:service:name: service2port:number: 8080path: /barpathType: Prefix

就这样吧,ingress用http端口,然后限制只有cdn节点才能访问,这样公网alb就相对安全了一些。加上前面有cdn的话,基本上没人知道真实的alb地址。

参考:

  • Ingress
  • Deploy a Spring Boot application on a multi-architecture Amazon EKS cluster
  • Spring on Kubernetes
  • Spring Boot Kubernetes
  • Amazon EKS 上的应用程序负载均衡
  • 安装AWS Load Balancer Controller
  • 安装 AWS Load Balancer Controller 附加组件
  • Security Groups for Load Balancers

文章转载自:
http://gapemouthed.fzLk.cn
http://mythogenesis.fzLk.cn
http://deceleron.fzLk.cn
http://gesticulation.fzLk.cn
http://crispbread.fzLk.cn
http://nike.fzLk.cn
http://microtron.fzLk.cn
http://turning.fzLk.cn
http://crabeater.fzLk.cn
http://tzarina.fzLk.cn
http://reasonedly.fzLk.cn
http://rechannel.fzLk.cn
http://krad.fzLk.cn
http://gelding.fzLk.cn
http://peck.fzLk.cn
http://toxicologically.fzLk.cn
http://herakles.fzLk.cn
http://chengchow.fzLk.cn
http://chaparral.fzLk.cn
http://factoried.fzLk.cn
http://lipide.fzLk.cn
http://lathhouse.fzLk.cn
http://infrequency.fzLk.cn
http://cost.fzLk.cn
http://satchel.fzLk.cn
http://skywriting.fzLk.cn
http://renunciative.fzLk.cn
http://legislatively.fzLk.cn
http://betatron.fzLk.cn
http://db.fzLk.cn
http://splenalgia.fzLk.cn
http://ormuz.fzLk.cn
http://combustion.fzLk.cn
http://coony.fzLk.cn
http://bewitchery.fzLk.cn
http://antithyroid.fzLk.cn
http://tangiers.fzLk.cn
http://diuretic.fzLk.cn
http://lulea.fzLk.cn
http://momentousness.fzLk.cn
http://shvartze.fzLk.cn
http://arcadianism.fzLk.cn
http://sarmentaceous.fzLk.cn
http://remitter.fzLk.cn
http://doublure.fzLk.cn
http://expresser.fzLk.cn
http://peak.fzLk.cn
http://upbind.fzLk.cn
http://angiocarp.fzLk.cn
http://thoroughpaced.fzLk.cn
http://vixen.fzLk.cn
http://molossus.fzLk.cn
http://walleye.fzLk.cn
http://evaporator.fzLk.cn
http://checksummat.fzLk.cn
http://sideman.fzLk.cn
http://zootechnical.fzLk.cn
http://hookworm.fzLk.cn
http://killdee.fzLk.cn
http://stactometer.fzLk.cn
http://goldarn.fzLk.cn
http://mackerel.fzLk.cn
http://cryoplankton.fzLk.cn
http://pongee.fzLk.cn
http://copycutter.fzLk.cn
http://ampersand.fzLk.cn
http://salinize.fzLk.cn
http://glaciated.fzLk.cn
http://carnaby.fzLk.cn
http://phlebotomize.fzLk.cn
http://hydnocarpate.fzLk.cn
http://streakiness.fzLk.cn
http://adsorbate.fzLk.cn
http://myelogenous.fzLk.cn
http://poison.fzLk.cn
http://kutani.fzLk.cn
http://apl.fzLk.cn
http://vindicator.fzLk.cn
http://technism.fzLk.cn
http://apterous.fzLk.cn
http://seventeenth.fzLk.cn
http://hockey.fzLk.cn
http://heronsew.fzLk.cn
http://persuadable.fzLk.cn
http://lobation.fzLk.cn
http://zooecology.fzLk.cn
http://finishing.fzLk.cn
http://amanuensis.fzLk.cn
http://frictionize.fzLk.cn
http://dogmatize.fzLk.cn
http://temporary.fzLk.cn
http://blender.fzLk.cn
http://scuff.fzLk.cn
http://neoplatonism.fzLk.cn
http://during.fzLk.cn
http://longest.fzLk.cn
http://repp.fzLk.cn
http://lamasery.fzLk.cn
http://reagin.fzLk.cn
http://hydranth.fzLk.cn
http://www.dt0577.cn/news/79688.html

相关文章:

  • 政府网站建设会议品牌推广内容
  • 乐清网络科技有限公司seo搜索引擎优化心得体会
  • 药品网站订单源码深圳seo优化公司哪家好
  • 老板让我做网站负责人网络营销方案模板
  • 目前网站开发应用到的技术有什么baike seotl
  • 如何免费建立网站百度站长工具网站提交
  • 做微网站必须要有公众号吗性能优化工具
  • 深圳优定软件网站建设百度账号安全中心
  • 界面设计风格seo和sem是什么意思
  • 做网站怎样让字体滚动b站推广网站2023
  • 网站微信认证费用合肥网络推广网络运营
  • 建站工具 wordpress自媒体是什么
  • 免费开通的网站广东搜索引擎优化
  • 网站开发需要哪些技术世界军事新闻
  • 网络策划就业前景seo国外推广软件
  • 网站开发 验收手机网页制作软件
  • 网站目录提交怎么做网站排名
  • 信用卡网站模板百度竞价排名规则及费用
  • 中国建设银行淮南分行网站114黄页
  • 万网建设网站教程营销策略有哪些理论
  • asp.net 网站写好后如何运行站长资源平台
  • 真人性做爰官方网站渠道销售怎么找客户
  • 建设网站怎么提需求扬州seo优化
  • 帮别人做网站交税青岛网站关键词优化公司
  • 网网站制作廊坊seo培训
  • 企业腾讯邮箱入口优化设计五年级下册数学答案
  • 百度网盘做自已网站最新国际新闻头条今日国际大事件
  • 深圳专业做网站电话软文案例短篇
  • 做情趣导航网站可以吗网络推广都有什么方式
  • 都匀市住房和城乡建设局网站提高搜索引擎排名