GoogleCloudPlatform/grpc-gke-nlb-tutorial

all SubConns are in TransientFailure

inaxium opened this issue · 0 comments

grpcurl -d '{"content": "frank"}' -proto echo-grpc/api/echo.proto -insecure -v 35.204.67.35:443 api.Echo/Echo

Work

package main

import (
	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"google.golang.org/grpc/keepalive"
	"log"
	"test_grpc_connect/api"
	"time"
)

func main() {


	var conn *grpc.ClientConn
	conn, err := grpc.Dial("35.204.67.35:443", grpc.WithInsecure(),
		grpc.WithKeepaliveParams(keepalive.ClientParameters{
			Time:                30 * time.Second,
			Timeout:             20 * time.Second,
			PermitWithoutStream: true,
		}))
	if err != nil {
		log.Fatalf("did not connect: %s", err)
	}

	defer conn.Close()

	c := api.NewEchoClient(conn)

	ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second))
	defer cancel()
	r, err := c.Echo(ctx, &api.EchoRequest{Content:"Frank"})
	if err != nil {
		log.Fatalf("could not echo: %v", err)
	}
	log.Printf("Echo: %s", r.Content)
}

Doesn't work.

I try a lot.

I could not find the right solution yet. Maybe you are faster.