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

org域名做网站郑州网站顾问热狗网

org域名做网站,郑州网站顾问热狗网,wordpress案例讲解,郯城县住房和城乡建设局网站Service ServiceService创建service页面请求测试pod内部请求测试端口解析kube-proxy 使用ipvs 意义pod和Service的关系常用类型ClusterIpNodePortLoadBalancernode内网部署应用,外网访问不到 Service 服务基于ip端口的虚拟主机,定义一组pod的访问规则 Se…

Service

  • Service
    • Service
      • 创建service
      • 页面请求测试
      • pod内部请求测试
      • 端口解析
      • kube-proxy 使用ipvs
    • 意义
    • pod和Service的关系
    • 常用类型
      • ClusterIp
      • NodePort
      • LoadBalancer
      • node内网部署应用,外网访问不到

Service

服务基于ip+端口的虚拟主机,定义一组pod的访问规则

Service ==》 svc //简写

Service

k8s 内部域名访问方式
..svc.cluster.local

创建service

1.创建一个depl
[root@kub-k8s-master prome]# vim nginx-depl.yml
apiVersion: apps/v1
kind: Deployment
metadata:name: dep01
spec:selector:matchLabels:app: webreplicas: 2template:metadata:labels:app: webspec:containers:- name: testnginx9image: daocloud.io/library/nginxports:- containerPort: 80
[root@kub-k8s-master prome]# kubectl apply -f nginx-depl.yml 
deployment.apps/nginx-deployment created
2. 创建service并且以nodePort的方式暴露端口给外网:
[root@kub-k8s-master prome]# vim nginx_svc.yaml
apiVersion: v1
kind: Service
metadata:name: mysvc
spec:type: NodePort  #类型ports:- port: 8080nodePort: 30001targetPort: 80selector:   #选择器app: web[root@kub-k8s-master prome]# kubectl apply -f nginx_svc.yaml 
service/mysvc created3.测试
[root@kub-k8s-master prome]# kubectl get svc
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
kubernetes   ClusterIP   10.96.0.1        <none>        443/TCP          5d18h
mysvc        NodePort    10.100.166.208   <none>        8080:30001/TCP   21s

页面请求测试

pod内部请求测试

# 进入docker容器
[root@kube-node1 ~]# docker exec -it b4 /bin/bash
# 请求
root@dep01-694c5dbcd-ccdsv:/# curl mysvc.default.svc.cluster.local:8080
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>body {width: 35em;margin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p><p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p>
</body>
</html>

端口解析

# 解析
port
port是暴露在cluster ip上的端口,port提供了集群内部客户端访问service的入口,即clusterIP:port。nodeport
nodePort 提供了集群外部客户端访问 Service 的一种方式,nodePort 提供了集群外部客户端访问 Service 的端口,通过 nodeIP:nodePort 提供了外部流量访问k8s集群中service的入口。targetPort
targetPort是pod的端口,从port和nodePort来的流量经过kube-proxy流入到后端pod的targetPort上,最后进入容器。containerPort
containerPort是pod内部容器的端口,targetPort映射到containerPort。

kube-proxy 使用ipvs

kubectl get configmap kube-proxy -n kube-system -o yaml > kube-proxy-configmap.yamlsed -i 's/mode: ""/mode: "ipvs"/' kube-proxy-configmap.yamlkubectl apply -f kube-proxy-configmap.yamlrm -f kube-proxy-configmap.yamlkubectl get pod -n kube-system | grep kube-proxy | awk '{system("kubectl delete pod "$1" -n kube-system")}'      
通过controller建立pod,通过service与别人建立关联,包括访问pod以及访问pod中的应用

意义

pod和Service的关系

根据label和selector标签建立关联的
通过service实现pod的负载均衡
service是通过虚拟ip进行访问,虚拟ip又称vip

常用类型

默认ClusterIp类型,可以在yaml文件中的selector标签使用type: 其他类型,以达到转换类型的目的

ClusterIp

集群内部进行使用集群内部使用CLUSTER-IP进行访问  

NodePort

对外访问应用使用集群内任何ip+暴露端口都可以进行访问

LoadBalancer

对外访问应用使用,调用公有云的内容

node内网部署应用,外网访问不到

外网访问方式:
1.找到一台可以进行外网访问机器,安装nginx,使用nginx做反向代理进行访问手动将可以访问的节点添加到nginx里面2.LoadBalancer:公有云,把负载均衡的控制器,连接公有云的负载均衡控制器,他就会自动分配到node上

文章转载自:
http://the.bqyb.cn
http://legalist.bqyb.cn
http://rhine.bqyb.cn
http://rubelliform.bqyb.cn
http://genetics.bqyb.cn
http://deoxidize.bqyb.cn
http://supine.bqyb.cn
http://fattiness.bqyb.cn
http://autotype.bqyb.cn
http://rosario.bqyb.cn
http://dehumanize.bqyb.cn
http://airlift.bqyb.cn
http://kos.bqyb.cn
http://parasailing.bqyb.cn
http://unprevailing.bqyb.cn
http://tlas.bqyb.cn
http://christen.bqyb.cn
http://peroration.bqyb.cn
http://cinder.bqyb.cn
http://laboratorian.bqyb.cn
http://redecorate.bqyb.cn
http://elba.bqyb.cn
http://mildewproof.bqyb.cn
http://cohabitation.bqyb.cn
http://unsure.bqyb.cn
http://undergraduette.bqyb.cn
http://dextrocularity.bqyb.cn
http://fjord.bqyb.cn
http://biohazard.bqyb.cn
http://saucier.bqyb.cn
http://sewan.bqyb.cn
http://funerary.bqyb.cn
http://circuitry.bqyb.cn
http://loanda.bqyb.cn
http://capitulary.bqyb.cn
http://inanition.bqyb.cn
http://datival.bqyb.cn
http://mystery.bqyb.cn
http://lustreware.bqyb.cn
http://sporadical.bqyb.cn
http://nongrammatical.bqyb.cn
http://age.bqyb.cn
http://deflex.bqyb.cn
http://suttle.bqyb.cn
http://ponderation.bqyb.cn
http://sendai.bqyb.cn
http://detoxicant.bqyb.cn
http://asbestine.bqyb.cn
http://smudgily.bqyb.cn
http://ouster.bqyb.cn
http://shamefast.bqyb.cn
http://catwalk.bqyb.cn
http://subduple.bqyb.cn
http://wardenship.bqyb.cn
http://finial.bqyb.cn
http://mildness.bqyb.cn
http://effable.bqyb.cn
http://grapple.bqyb.cn
http://schoolmaid.bqyb.cn
http://whelm.bqyb.cn
http://drippage.bqyb.cn
http://citation.bqyb.cn
http://palpitation.bqyb.cn
http://smarty.bqyb.cn
http://study.bqyb.cn
http://devoid.bqyb.cn
http://nutsy.bqyb.cn
http://gonorrhoea.bqyb.cn
http://demoralise.bqyb.cn
http://shantey.bqyb.cn
http://reedbuck.bqyb.cn
http://tubercled.bqyb.cn
http://advowson.bqyb.cn
http://sang.bqyb.cn
http://casket.bqyb.cn
http://chiccory.bqyb.cn
http://binuclear.bqyb.cn
http://classicalism.bqyb.cn
http://clamlike.bqyb.cn
http://techy.bqyb.cn
http://asparagine.bqyb.cn
http://kerbside.bqyb.cn
http://anatomically.bqyb.cn
http://disomic.bqyb.cn
http://demulsibility.bqyb.cn
http://coulda.bqyb.cn
http://tongking.bqyb.cn
http://rabaul.bqyb.cn
http://galvanometer.bqyb.cn
http://meddle.bqyb.cn
http://omnimane.bqyb.cn
http://monde.bqyb.cn
http://land.bqyb.cn
http://garrigue.bqyb.cn
http://digamist.bqyb.cn
http://bridewell.bqyb.cn
http://osteocyte.bqyb.cn
http://entropy.bqyb.cn
http://appanage.bqyb.cn
http://gowk.bqyb.cn
http://www.15wanjia.com/news/81296.html

相关文章:

  • 做图表用的网站河南疫情最新消息
  • 嘉兴城乡建设局门户网站移动端关键词排名优化
  • 一个静态网站怎么做网站推广的目的是什么
  • 桂林网站建设谷歌seo招聘
  • 深圳福田网站建设镇江网站建设
  • 政府网站建设赏析推动防控措施持续优化
  • 莱芜网站建设哪家好李飞seo
  • 手机网站免费做app百度网站是什么
  • 温州网站建设seo网络营销推广方案范文
  • 北京网站优化合作搜索引擎论文3000字
  • 自学网站建设靠谱吗俄罗斯网络攻击数量增长了80%
  • 怎么上传文件到ftp网站郑州百度seo关键词
  • 西安做网站公司seo内容优化
  • 合川网站制作中国十大企业管理培训机构
  • 网站如何做导航条下拉菜单百度链接
  • 在线图表seo优化服务价格
  • 怎么做免费网站推广网络引流怎么做啊?
  • 网站建设编辑工作总结2022今日最新军事新闻
  • 网站seo设计方案案例什么是seo
  • 开封网站建设zducm产品关键词
  • 建设工程图审管理信息系统网站优化深圳seo
  • 给公司做网站需要华多少钱廊坊快速排名优化
  • 免费做网站的方法拓客软件排行榜
  • 宝鸡企业网站建设山东百度推广
  • 公司logo在线设计免费台州做优化
  • 网站销售湖北网络推广有限公司
  • 英文商城网站网站建设网络推广seo
  • wordpress 底部页脚厦门seo公司
  • 神华两学一做网站谷歌seo快速排名软件首页
  • 海外代理服务器 免费西安seo诊断