Ingress
Ingress部署
官网下载yaml文件
官网地址:
https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal
wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.47.0/deploy/static/provider/baremetal/deploy.yaml
将镜像上传至集群使用的harbor仓库,并修改yaml文件中image:
地址
应用这个yaml文件
kubectl apply -f deploy.yaml
kubectl -n ingress-nginx edit svc ingress-nginx-controller
将type改成LoadBalancer
查看创建出的ns
kubectl get ns
查看这个ns的全部信息
kubectl -n ingress-nginx get all
如果svc里面没有出现ingress-nginx-controller 的EXTERNAL-IP 则参考此连接文章的LoadBalancer 将这个类型部署一个ConfigMap
https://blog.csdn.net/Puuwuuchao/article/details/119172011#t5
Ingress-nginx+域名解析
创建pod:nginx myapp
vim deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: myapp:v1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
labels:
app: myapp
spec:
replicas: 3
selector:
matchLabels<