k8s安装ingress-nginx
时间: 2024-06-12 14:11:12 浏览: 160
好的,关于k8s安装ingress-nginx,你可以按照以下步骤进行操作:
1. 添加ingress-nginx的helm chart仓库:
```
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
```
2. 安装ingress-nginx:
```
helm install ingress-nginx ingress-nginx/ingress-nginx
```
3. 等待ingress-nginx部署完成,可以使用以下命令查看ingress-nginx的状态:
```
kubectl get pods -n ingress-nginx
```
4. 部署Ingress资源,例如:
```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: example.com
http:
paths:
- path: /example
pathType: Prefix
backend:
service:
name: example-service
port:
name: http
```
阅读全文