Git Product home page Git Product logo

Comments (9)

kms9 avatar kms9 commented on August 26, 2024 2

@gaoxinge 给到的示例 使用的是 dubbo-go v3里面默认的配置 运行确实没有问题 但是 自己替换 user的暴露的方法时候 遇到了 注册到 k8s dubbo.io/annotation 的 还是 /dubbo/com.ikurento.user.UserProvider/providers 不会根据配置文件改变.

from dubbo-go-samples.

kms9 avatar kms9 commented on August 26, 2024 1

k8s-registry.zip

@gaoxinge 基于你给的demo修改后的代码

from dubbo-go-samples.

kms9 avatar kms9 commented on August 26, 2024 1

看了一下 源码 修改一下 账号的配置就可以了.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: dserver
spec:
  replicas: 2
  selector:
    matchLabels:
      role: dserver
  template:
    metadata:
      labels:
        role: dserver
    spec:
      containers:
        - image: 10.8.8.207:6080/rancher/dserver:v1.1
          name: server
          env:
            - name: DUBBO_NAMESPACE
              value: "default,tools"
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          imagePullPolicy: Always
      serviceAccountName: dubbo-sa

配置一下 监听的这里

 - name: DUBBO_NAMESPACE
              value: "default,tools"

from dubbo-go-samples.

AlexStocks avatar AlexStocks commented on August 26, 2024

cc @sxllwx

from dubbo-go-samples.

kms9 avatar kms9 commented on August 26, 2024

截止到目前 自己使用最新版本的dubbo-go进行编译运行在k8s环境下直接报错

2021-06-21T14:46:11.273+0800	WARN	kubernetes/client.go:178	new kubernetes client: new dubbo-registry controller: init pod informer: read value from env by key (DUBBO_NAMESPACE)) 
github.com/apache/dubbo-go/remoting/kubernetes.ValidateClient 
	/root/vendor/github.com/apache/dubbo-go/remoting/kubernetes/client.go:178 
github.com/apache/dubbo-go/registry/kubernetes.newKubernetesRegistry 
	/root/vendor/github.com/apache/dubbo-go/registry/kubernetes/registry.go:166 
github.com/apache/dubbo-go/common/extension.GetRegistry 
	/root/vendor/github.com/apache/dubbo-go/common/extension/registry.go:39 
github.com/apache/dubbo-go/registry/protocol.getRegistry 
	/root/vendor/github.com/apache/dubbo-go/registry/protocol/protocol.go:86 
github.com/apache/dubbo-go/registry/protocol.(*registryProtocol).Refer 
	/root/vendor/github.com/apache/dubbo-go/registry/protocol/protocol.go:142 
github.com/apache/dubbo-go/config.(*ReferenceConfig).Refer 
	/root/vendor/github.com/apache/dubbo-go/config/reference_config.go:135 
github.com/apache/dubbo-go/config.loadConsumerConfig 
	/root/vendor/github.com/apache/dubbo-go/config/config_loader.go:145 
github.com/apache/dubbo-go/config.Load 
	/root/vendor/github.com/apache/dubbo-go/config/config_loader.go:354 
main.main 
	/root/go-client-pure/cmd/client.go:62 
runtime.main 
	/usr/local/go/src/runtime/proc.go:204 
2021-06-21T14:46:11.273+0800	ERROR	protocol/protocol.go:88	Registry can not connect success, program is going to panic.Error message is new kubernetes client: new dubbo-registry controller: init pod informer: read value from env by key (DUBBO_NAMESPACE) 
github.com/apache/dubbo-go/registry/protocol.getRegistry 
	/root/vendor/github.com/apache/dubbo-go/registry/protocol/protocol.go:88 
github.com/apache/dubbo-go/registry/protocol.(*registryProtocol).Refer 
	/root/vendor/github.com/apache/dubbo-go/registry/protocol/protocol.go:142 
github.com/apache/dubbo-go/config.(*ReferenceConfig).Refer 
	/root/vendor/github.com/apache/dubbo-go/config/reference_config.go:135 
github.com/apache/dubbo-go/config.loadConsumerConfig 
	/root/vendor/github.com/apache/dubbo-go/config/config_loader.go:145 
github.com/apache/dubbo-go/config.Load 
	/root/vendor/github.com/apache/dubbo-go/config/config_loader.go:354 
main.main 
	/root/go-client-pure/cmd/client.go:62 
runtime.main 
	/usr/local/go/src/runtime/proc.go:204 
panic: new kubernetes client: new dubbo-registry controller: init pod informer: read value from env by key (DUBBO_NAMESPACE) 
 

from dubbo-go-samples.

gaoxinge avatar gaoxinge commented on August 26, 2024

I create a repository for k8s registry, and master branch denotes the latest (latest denotes v3.0.0-rc2 temporarily). @whitekeyboard @kms9

@kms9 To solve your error, add a dubbo namespace environment in client.yaml. This environment variable ([1], [2]) seems to be used for client to watch the namespace where server reside.

from dubbo-go-samples.

gaoxinge avatar gaoxinge commented on August 26, 2024

@kms9 是把下面两个文件关于user的暴露的方法都改了,但是pod的annotation的key dubbo.io/annotation对应的value还是没有变?

from dubbo-go-samples.

gaoxinge avatar gaoxinge commented on August 26, 2024

@kms9 你的意思是:虽然改了代码和配置,但是感觉新代码没有生效,pod里面还是跑的老代码?

直接拿你的代码跑了一下,也单独建了一个分支(改了一些路径和镜像名,其他保持一致)跑了一下,新代码应该没有问题(client pod能打印出结果):

929A8D05-06C5-4c76-98E3-2B6457EE12F0

我猜测可能是:client.sh/server.sh中打完镜像,上传镜像,然后k8s去拉镜像(client-k8s.yaml/server-k8s.yaml里面是imagePullPolicy: Always,每次都会拉镜像,写的很细节)的时候,会不会远程hub缓存了老的镜像,导致拉取下来的任然是老的镜像。

你要不每次打镜像的时候,都更新一下tag(现在一直是v1.1),然后多试几次看看。

from dubbo-go-samples.

kms9 avatar kms9 commented on August 26, 2024

@gaoxinge 实验了一下 代码确实可以的. 不过 貌似不支持夸namespace? 不知道是不是我配置的问题.

from dubbo-go-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.