当前位置:网站首页>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.
边栏推荐
- QT5.5.1桌面版安装配置过程中的疑难杂症处理(配置ARM编译套件)
- 16 -- remove invalid parentheses
- Redis系列2:数据持久化提高可用性
- 域名绑定动态IP最佳实践
- If you want to use DMS to handle database permissions, can you only use Alibaba cloud ram accounts (Alibaba cloud RDS)
- A distribution fission activity is more than just a circle of friends!
- 开源二三事|ShardingSphere 与 Database Mesh 之间不得不说的那些事
- The role of the symbol @ in MySQL
- 等保三级密码复杂度是多少?多久更换一次?
- 一场分销裂变活动,不止是发发朋友圈这么简单!
猜你喜欢

Array represents a collection of several intervals. Please merge all overlapping intervals and return a non overlapping interval array. The array must exactly cover all the intervals in the input. 【Le

Introduce you to ldbc SNB, a powerful tool for database performance and scenario testing

A robot is located in the upper left corner of an M x n grid. The robot can only move down or right one step at a time. The robot attempts to reach the lower right corner of the grid. How many differe

【牛客刷题】NowCoder号称自己已经记住了1-100000之间所有的斐波那契数。 为了考验他,我们随便出一个数n,让他说出第n个斐波那契数。如果第n个斐波那契大于6位则只取后6位。
A large number of missing anchor text
锚文本大量丢失的问题

事务的四大特性

Etcd visualization tool: kstone deployment (I), rapid deployment based on Helm

Centos8 PostgreSQL initialization error: initdb: error: invalid locale settings; check LANG and LC_* environment

Bit.Store:熊市漫漫,稳定Staking产品或成主旋律
随机推荐
数组表示若干个区间的集合,请你合并所有重叠的区间,并返回 一个不重叠的区间数组,该数组需恰好覆盖输入中的所有区间 。【LeetCodeHot100】
字节跳动埋点数据流建设与治理实践
Pragma once Usage Summary
Bit. Store: long bear market, stable stacking products may become the main theme
继手机之后 报道称三星也削减了电视等家电产品线的产量
16 -- remove invalid parentheses
Cesium realizes satellite orbit detour
Yyds dry inventory brief chrome V8 engine garbage collection
事务的四大特性
Redis Series 2: data persistence improves availability
Four characteristics of transactions
NFT dual currency pledge liquidity mining DAPP contract customization
10分钟掌握mysql的安装步骤
ORM表关系及操作
Design of vga/lcd display controller based on FPGA (with code)
3.1 simple condition judgment
Taishan Office Technology Lecture: the first difficulty is vertical positioning
Condom giants' sales have fallen by 40% in the past two years. What are the reasons for the decline?
华为云DevCloud重磅发布四大新能力,创下国内两项第一
利用Redis实现订单30分钟自动取消