美文网首页
ingress nginx 用法

ingress nginx 用法

作者: akka9 | 来源:发表于2019-08-17 00:09 被阅读0次

    部署 whoami 应用

    # whoami.yaml
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: whoami-deployment
    spec:
      replicas: 4
      template:
        metadata:
          labels:
            app: whoami
            group: app1
        spec:
          containers:
          - image: containous/whoami
            name: whoami
            ports:
            - containerPort: 80
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: whoami
    spec:
      selector:
        app: whoami
        group: app1
      ports:
        - protocol: TCP
          port: 80
          targetPort: 80
    ---
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: nginx-ingress
    spec:
      rules:
      - host: whoami.domain.com
      - host: whoami
        http:
          paths:
          - backend:
              serviceName: whoami
              servicePort: 80
    
    kubectl get svc --all-namespaces
    
    curl -D- -H 'host:whoami' http://<ingress-nginx-EXTERNAL-IP>
    

    相关文章

      网友评论

          本文标题:ingress nginx 用法

          本文链接:https://www.haomeiwen.com/subject/arncsctx.html