当前位置:网站首页>Kubernetes基础自学系列 | Ingress API讲解
Kubernetes基础自学系列 | Ingress API讲解
2022-06-27 15:45:00 【51CTO】
视频来源:B站《2021 年末倾力打造 Kubernetes 入门至精通 - 2022 年幸福的开胃菜》
一边学习一边整理老师的课程内容及试验笔记,并与大家分享,侵权即删,谢谢支持!
资料信息
Ingress-Nginx github 地址:
https://github.com/kubernetes/ingress-nginx
Ingress-Nginx 官方网站:
https://kubernetes.github.io/ingress-nginx/


部署 Ingress-Nginx
Ingress HTTP 代理访问
deployment、Service、Ingress Yaml 文件
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-dm
spec:
replicas: 2
template:
metadata:
labels:
name: nginx
spec:
containers:
- name: nginx
image: wangyanglinux/myapp:v1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
name: nginx
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx-test
spec:
rules:
- host: www1.hongfu.com
http:
paths:
- path: /
backend:
serviceName: nginx-svc
servicePort: 80
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
Ingress HTTPS 代理访问
创建证书,以及 cert 存储方式
deployment、Service、Ingress Yaml 文件
Nginx 进行 BasicAuth
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: auth.hongfu.com
annotations:
nginx.ingress.kubernetes.io/auth-type: basic
nginx.ingress.kubernetes.io/auth-secret: basic-auth
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - foo'
spec:
rules:
- host: auth.hongfu.com
http:
paths:
- path: /
backend:
serviceName: nginx-svc
servicePort: 80
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
Nginx 进行重写
名称 | 描述 | 值 |
nginx.ingress.kubernetes.io/rewrite-target | 必须重定向流量的目标URI | 串 |
nginx.ingress.kubernetes.io/ssl-redirect | 指示位置部分是否仅可访问SSL(当Ingress包含证书时默认为True) | 布尔 |
nginx.ingress.kubernetes.io/force-ssl-redirect | 即使Ingress未启用TLS,也强制重定向到HTTPS | 布尔 |
nginx.ingress.kubernetes.io/app-root | 定义Controller必须重定向的应用程序根,如果它在'/'上下文中 | 串 |
nginx.ingress.kubernetes.io/use-regex | 指示Ingress上定义的路径是否使用正则表达式 | 布尔 |
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: rew.hongfu.com
annotations:
nginx.ingress.kubernetes.io/rewrite-target: https://www.baidu.com
spec:
rules:
- host: rew.hongfu.com
http:
paths:
- path: /
backend:
serviceName: nginx-svc
servicePort: 80
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
边栏推荐
- Etcd visualization tool: kstone deployment (I), rapid deployment based on Helm
- List转Table
- 关于#mysql#的问题:问题遇到的现象和发生背景
- 是不是只要支持JDBC / ODBC协议的客户端恐惧,PolarDB-X可通过相关工具的客户端访问?
- 树莓派初步使用
- 目前PolarDB-X是不支持数据库自制服务DAS么?
- The time of localdatetime type (2019-11-19t15:16:17) is queried with the time range of Oracle
- NFT双币质押流动性挖矿dapp合约定制
- Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance
- Etcd可视化工具:Kstone部署(一),基于Helm快速部署
猜你喜欢

Etcd可视化工具:Kstone部署(一),基于Helm快速部署

Leetcode daily practice (Yanghui triangle)

郎酒两大王牌产品成都联动共振,持续带动光瓶酒消费浪潮
The role of the symbol @ in MySQL

What should the ultimate LAN transmission experience be like
A large number of missing anchor text

Source NAT address translation and server mapping web page configuration of firewall Foundation

Alibaba cloud liupeizi: Inspiration from cloud games - innovation on the end

SIGKDD22|图“预训练、提示、微调”范式下的图神经网络泛化框架

Practice of constructing ten billion relationship knowledge map based on Nebula graph
随机推荐
Hung - Mung! HDD Hangzhou station · salon hors ligne vous invite à construire l'écologie
SQL parsing practice of Pisa proxy
logstash排除特定文件或文件夹不采集上报日志数据
Leetcode daily practice (Yanghui triangle)
锚文本大量丢失的问题
Slow bear market, bit Store provides stable stacking products to help you cross the bull and bear
PolarDB-X开源版有没有支持 mysql5.7 的版本?
Nemo of pulseaudio (22)
Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance
A large number of missing anchor text
Event listening mechanism
New method of cross domain image measurement style relevance: paper interpretation and code practice
等保2.0密码要求是什么?法律依据有哪些?
Redis Series 2: data persistence improves availability
16 -- remove invalid parentheses
C語言教師工作量管理系統
Open source 23 things shardingsphere and database mesh have to say
Weekly snapshot of substrate technology 20220411
泰山OFFICE技术讲座:第一难点是竖向定位
[pyGame games] this "eat everything" game is really wonderful? Eat them all? (with source code for free)