026.掌握Service-外部访问
一 集群外部访问
1.1 外部访问——映射Pod到物理机
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 name: webapp
5 labels:
6 app: webapp
7 spec:
8 containers:
9 - name: webapp
10 image: tomcat
11 ports:
12 - containerPort: 8080
13 hostPort: 8081
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 name: webapp2
5 labels:
6 app: webapp2
7 spec:
8 hostNetwork: true
9 containers:
10 - name: webapp2
11 image: tomcat
12 ports:
13 - containerPort: 8080
14 hostPort: 8080
1.2 外部访问——映射Service到物理机
1 apiVersion: v1
2 kind: Service
3 metadata:
4 name: webapp
5 spec:
6 type: NodePort
7 ports:
8 - port: 8080
9 targetPort: 8080
10 nodePort: 8081
11 selector:
12 app: webapp
1 ExecStart=/opt/k8s/bin/kube-apiserver \
2 ……
3 --service-node-port-range=1-65535 \ #添加此参数
4 ……
1 apiVersion: v1
2 kind: Service
3 metadata:
4 name: my-service
5 spec:
6 type: LoadBalancer
7 selector:
8 app: MyApp
9 ports:
10 - protocol: TCP
11 port: 80
12 targetPort: 9376
13 nodePort: 30061
14 clusterIP: 10.0.171.239
15 status:
16 loadBalancer:
17 ingress:
18 - ip: 47.96.145.131

026.掌握Service-外部访问的更多相关文章
- 【Kubernetes】Kubernetes的Service外部访问方式:NodePort和LoadBalancer
Kubernetes的Pod的寿命是有限的,它们不会复活,因此尽管每个Pod都有自己的IP地址,但是这些IP地址是不可靠的,会随着Pod的消亡而消失. 这就带来一个问题,如果一些Pod的集合(称之为b ...
- 【Azure微服务 Service Fabric 】Service Fabric中应用开启外部访问端口及微服务之间通过反向代理端口访问问题
问题描述 1) 当成功的在Service Fabric集群中部署了应用后,如何来访问呢?如果是一个Web服务,它的URL又是什么呢? 2) 当Service Fabric集群中,服务之间如需要相互访问 ...
- ubuntu系统lamp环境搭建、数据库迁移、设置数据库外部访问
sudo passwd root设置两次密码su输入设置的密码exit (退出root帐号) 1.sudo apt-get update 2.sudo apt-get install apache2 ...
- centos 下安装jdk、tomcat 以及tomcat无法从外部访问的解决办法
centos 下安装jdk.tomcat 以及tomcat无法从外部访问的解决办法 原创 2014年08月28日 10:24:33 标签: selinux enforce cent 2223 昨天在c ...
- 解决CentOS7安装Tomcat不能被外部访问的问题
在CentOS7安装了Tomcat,在服务器内部使用火狐浏览器通过localhost:8080是可以访问的,但是不能被外部访问,主要原因是因为防火墙的存在,导致端口不能被访问.CentOS是使用fir ...
- Kubernetes的三种外部访问方式:NodePort、LoadBalancer和Ingress(转发)
原文 http://cloud.51cto.com/art/201804/570386.htm Kubernetes的三种外部访问方式:NodePort.LoadBalancer和Ingress 最近 ...
- [转帖] 外部访问k8s 里面pod的方式方法
https://jimmysong.io/posts/accessing-kubernetes-pods-from-outside-of-the-cluster/ 从外部访问Kubernetes中的P ...
- 通过NAT实例实现外部访问AWS的ElastiCache资源
ElastiCache作为AWS的内存缓存组建可以说做的一点也不友好了, 你可以通过ElastiCache创建redis,memcache的实例,却不能被外部访问. 背景 人傻钱多的客户总有人傻钱多的 ...
- 【转载】浅析从外部访问 Kubernetes 集群中应用的几种方式
一般情况下,Kubernetes 的 Cluster Network 是属于私有网络,只能在 Cluster Network 内部才能访问部署的应用.那么如何才能将 Kubernetes 集群中的应用 ...
随机推荐
- TCP并发、GIL、锁
TCP实现并发 #client客户端 import socket client = socket.socket() client.connect(('127.0.0.1',8080)) while T ...
- php获取服务器和mysql等信息输出到页面(基于ci框架)
function show($varName) { switch($result = get_cfg_var($varName)) { case 0: return '< ...
- 量化预测质量之分类报告 sklearn.metrics.classification_report
classification_report的调用为:classification_report(y_true, y_pred, labels=None, target_names=None, samp ...
- [LC] 19. Remove Nth Node From End of List
Given a linked list, remove the n-th node from the end of list and return its head. Example: Given l ...
- 树形dp(最小支配集)
http://poj.org/problem?id=3659 #include<iostream> #include<cstring> #include<algorith ...
- deeplearning.ai 序列模型 Week 2 NLP & Word Embeddings
1. Word representation One-hot representation的缺点:把每个单词独立对待,导致对相关词的泛化能力不强.比如训练出“I want a glass of ora ...
- JDBC原理之层次结构
目录 JDBC的层次结构 前言 Collection角色 Statement角色 ResultSet角色 JDBC工作的基本流程 JDBC的层次结构 前言 JDBC API提供了以下接口和类: Dri ...
- Java开发面试常见问题合集
次面试事故 面试官:你看过哪些源码?我:都挺熟悉的面试官:对hashMap了解程度怎么样?面试官:那你能讲讲 HashMap的实现原理吗?面试官:HashMap什么时候会进行 rehash?面试官:结 ...
- 关闭”xx程序已停止工作”提示窗口
运行注册表编辑器,依次定位到HKEY_CURRENT_USER\Software\Microsoft\Windows\WindowsError Reporting,在右侧窗口中找到并双击打开Donts ...
- absorb|state|
ADJ-GRADED 极感兴趣的:专心的:全神贯注的If you are absorbed in something or someone, you are very interested in th ...