• [goolegke]nginxingress建立测试


    1、google账号选择

    gcloud init

    # 注需要googlecloud权限

    2、链接对应gke集群

    gcloud container clusters get-credentials <集群名> --zone <地区> --project <项目>

    3、helm安装

    curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3

    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx

    3、建立静态账号

    gcloud compute addresses create ingress-test-static-ip-address

    4、建立namespace

    cat ingress-namespace.yaml
    apiVersion: v1
    kind: Namespace
    metadata:
      name: ingress-nginx
    # 执行  
    kubectl create -f ingress-namespace.yaml
    
    

      

    5、静态IP启动service和ingress

    helm install nginx-ingress ingress-nginx/ingress-nginx --namespace ingress-nginx --set controller.service.loadBalancerIP=<静态IP>

    加2个副本

    helm upgrade nginx-ingress ingress-nginx/ingress-nginx --namespace ingress-nginx --set controller.replicaCount=2 

    6、测试ingress

    cat ingress-resource.yaml
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-hello
      annotations:
        kubernetes.io/ingress.class: "nginx"
        nginx.ingress.kubernetes.io/ssl-redirect: "false"
    spec:
      rules:
      - host: "k8s-hello.k8s123.com"
        http:
          paths:
          - pathType: Prefix
            path: "/hello"
            backend:
              service:
                name: hello-app
                port:
                  number: 8080
    			  
    kubectl apply -f ingress-resource.yaml  

    访问:

    http://k8s-hello.k8s123.com/hello

  • 相关阅读:
    推送(评论,点赞,关注)
    php组成数组
    week6 10 后端backend server和mongoDB通信
    week06 09 NodeJS Server as a RPCclient
    week06 08 postman 测试jsonrpc
    week06 07 创建RPC SERVER 换个镜像安装下载
    week05 06绑定滚动条 去抖动
    week05 05restful api
    week5 04 npm run build
    week5 03 continus loading news
  • 原文地址:https://www.cnblogs.com/wangshuyang/p/15610093.html
Copyright © 2020-2023  润新知