Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 1.01 KB

3.deploy_app_with_ingress_nginx.md

File metadata and controls

51 lines (37 loc) · 1.01 KB

背景说明

本章节介绍使用 ingress-inginx 暴露服务

操作步骤

  1. 部署 ingress-nginx
# 留意是否需要从参考链接获取最新版本部署
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.2/deploy/static/provider/aws/deploy.yaml
  1. 部署 http-svc 服务
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/docs/examples/http-svc.yaml
  1. 通过 nginx-ingress 暴露 http-svc 服务
cat <<EOF > ingress-http-svc.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-http-svc
spec:
  rules:
  - host: http-svc.foo.org
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: http-svc
            port:
              number: 80
  ingressClassName: nginx
EOF


kubectl apply -f ingress-http-svc.yaml

参考资料

  1. ingress-nginx 在 EKS 部署