Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

创建DynamicConfiguration后,k8s集群configmap无法同步到nacos #11

Open
yangMHyang opened this issue Jan 24, 2024 · 2 comments
Open

Comments

@yangMHyang
Copy link

yangMHyang commented Jan 24, 2024

环境
centos7 Linux 4.17.11-1.el7.elrepo.x86_64 #1 SMP Sat Jul 28 09:33:09 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
k8s 1.16.15

资源
cluster2server.yaml

apiVersion: nacos.io/v1
kind: DynamicConfiguration
metadata:
name: dc-demo-cluster2server
spec:
dataIds:

  • data-id1.properties
  • data-id2.yml
    nacosServer:
    serverAddr: nacos-headless.default:8848
    namespace: test
    group: default
    authRef:
    apiVersion: v1
    kind: Secret
    name: nacos-auth
    strategy:
    syncPolicy: Always
    syncDirection: cluster2server
    syncDeletion: true
    objectRef:
    apiVersion: v1
    kind: ConfigMap
    name: nacos-config-cm

apiVersion: v1
kind: ConfigMap
metadata:
name: nacos-config-cm
namespace: default
data:
data-id1.properties: |
key=value
key2=value2
data-id2.yml: |
app:
name: test

apiVersion: v1
data:
ak: YQo= #未开启认证,随便设置的,nacos-controller未报错
sk: YQo=
kind: Secret
metadata:
name: nacos-auth
namespace: default

server2cluster.yaml

apiVersion: nacos.io/v1
kind: DynamicConfiguration
metadata:
name: dc-demo-server2cluster
spec:
dataIds:

  • data-id1.properties
  • data-id2.yml
    nacosServer:
    serverAddr: nacos-headless.default:8848
    namespace: public
    group: default
    authRef:
    apiVersion: v1
    kind: Secret
    name: nacos-auth
    strategy:
    syncPolicy: Always
    syncDirection: server2cluster
    syncDeletion: true

k8s编辑nacos-config-cm后,nacos-controller日志如下:
2024-01-24T07:22:34Z INFO dynamicconfiguration-resource default {"name": "dc-demo-server2cluster"}
2024-01-24T07:22:34Z INFO dynamicconfiguration-resource validate update {"name": "dc-demo-server2cluster"}
2024-01-24T07:22:34Z INFO dynamicconfiguration-resource default {"name": "dc-demo-server2cluster"}
2024-01-24T07:22:34Z INFO dynamicconfiguration-resource validate update {"name": "dc-demo-server2cluster"}
2024-01-24T07:22:42Z INFO dynamicconfiguration-resource default {"name": "dc-demo-server2cluster"}
2024-01-24T07:22:42Z INFO dynamicconfiguration-resource validate create {"name": "dc-demo-server2cluster"}
2024-01-24T07:22:42Z INFO Add finalizer {"controller": "dynamicconfiguration", "controllerGroup": "nacos.io", "controllerKind": "DynamicConfiguration", "DynamicConfiguration": {"name":"dc-demo-server2cluster","namespace":"default"}, "namespace": "default", "name": "dc-demo-server2cluster", "reconcileID": "91d769db-c145-42e3-b8ae-20a9f70afdc6"}
2024-01-24T07:22:42Z INFO dynamicconfiguration-resource default {"name": "dc-demo-server2cluster"}
2024-01-24T07:22:42Z INFO dynamicconfiguration-resource validate update {"name": "dc-demo-server2cluster"}
2024-01-24T07:22:42Z INFO start listening from nacos server {"controller": "dynamicconfiguration", "controllerGroup": "nacos.io", "controllerKind": "DynamicConfiguration", "DynamicConfiguration": {"name":"dc-demo-server2cluster","namespace":"default"}, "namespace": "default", "name": "dc-demo-server2cluster", "reconcileID": "91d769db-c145-42e3-b8ae-20a9f70afdc6", "group": "default", "namespace": "public", "dataId": "data-id1.properties"}
2024-01-24T07:22:42Z INFO start listening from nacos server {"controller": "dynamicconfiguration", "controllerGroup": "nacos.io", "controllerKind": "DynamicConfiguration", "DynamicConfiguration": {"name":"dc-demo-server2cluster","namespace":"default"}, "namespace": "default", "name": "dc-demo-server2cluster", "reconcileID": "91d769db-c145-42e3-b8ae-20a9f70afdc6", "group": "default", "namespace": "public", "dataId": "data-id2.yml"}
2024-01-24T07:31:57Z INFO config published to nacos server {"controller": "dynamicconfiguration", "controllerGroup": "nacos.io", "controllerKind": "DynamicConfiguration", "DynamicConfiguration": {"name":"dc-demo-cluster2server","namespace":"default"}, "namespace": "default", "name": "dc-demo-cluster2server", "reconcileID": "798963a0-c062-4c02-ab81-3822d76d5a89", "group": "default", "namespace": "test", "dataId": "data-id1.properties"}
2024-01-24T07:31:57Z INFO skip syncing, due to same md5 of content {"controller": "dynamicconfiguration", "controllerGroup": "nacos.io", "controllerKind": "DynamicConfiguration", "DynamicConfiguration": {"name":"dc-demo-cluster2server","namespace":"default"}, "namespace": "default", "name": "dc-demo-cluster2server", "reconcileID": "798963a0-c062-4c02-ab81-3822d76d5a89", "group": "default", "namespace": "test", "dataId": "data-id2.yml", "md5": "4e22ae55a981aa1e934f08e71c9603ff"}
2024-01-24T07:31:57Z INFO skip syncing, due to same md5 of content {"controller": "dynamicconfiguration", "controllerGroup": "nacos.io", "controllerKind": "DynamicConfiguration", "DynamicConfiguration": {"name":"dc-demo-cluster2server","namespace":"default"}, "namespace": "default", "name": "dc-demo-cluster2server", "reconcileID": "18a7b1c1-bbe3-4df6-b4f9-c54687d73c5b", "group": "default", "namespace": "test", "dataId": "data-id1.properties", "md5": "d8d9a26f34fa1f8e9c1c8bc2e83e0262"}
2024-01-24T07:31:57Z INFO skip syncing, due to same md5 of content {"controller": "dynamicconfiguration", "controllerGroup": "nacos.io", "controllerKind": "DynamicConfiguration", "DynamicConfiguration": {"name":"dc-demo-cluster2server","namespace":"default"}, "namespace": "default", "name": "dc-demo-cluster2server", "reconcileID": "18a7b1c1-bbe3-4df6-b4f9-c54687d73c5b", "group": "default", "namespace": "test", "dataId": "data-id2.yml", "md5": "4e22ae55a981aa1e934f08e71c9603ff"}

未见明显报错,且有更新成功的日志,但是nacos server端配置并未变更
image
image
请问如何解决

@yangMHyang
Copy link
Author

yangMHyang commented Jan 24, 2024

进入到容器里面,发现日志报这个错误

Unsupported payload type

/ # tail -f /tmp/nacos/log/nacos-sdk.log
2024-01-24T13:05:39.765Z DEBUG rpc/rpc_client.go:290 config-0-a971aff5-17b8-400f-b86b-7c16ed5d2172 register server push request:ConnectResetRequest handler:ConnectResetRequestHandler
2024-01-24T13:05:39.765Z DEBUG rpc/rpc_client.go:290 config-0-a971aff5-17b8-400f-b86b-7c16ed5d2172 register server push request:ClientDetectionRequest handler:ClientDetectionRequestHandler
2024-01-24T13:05:39.765Z INFO rpc/rpc_client.go:224 [RpcClient.Start] config-0-a971aff5-17b8-400f-b86b-7c16ed5d2172 try to connect to server on start up, server: {serverIp:nacos-headless.default serverPort:8848 serverGrpcPort:9848}
2024-01-24T13:05:39.765Z INFO util/common.go:96 Local IP:10.233.66.153
2024-01-24T13:05:39.769Z ERROR rpc/grpc_client.go:244 1706101539767_10.233.66.153_42756 Unsupported payload type
2024-01-24T13:05:39.870Z INFO rpc/rpc_client.go:234 config-0-a971aff5-17b8-400f-b86b-7c16ed5d2172 success to connect to server {serverIp:nacos-headless.default serverPort:8848 serverGrpcPort:9848} on start up, connectionId=1706101539767_10.233.66.153_42756
2024-01-24T13:05:39.872Z ERROR cache/disk_cache.go:86 failed to delete config file,cache:/tmp/nacos/cache/config/data-id1.properties@@default@@public ,value: ,err:remove /tmp/nacos/cache/config/data-id1.properties@@default@@public: no such file or directory
2024-01-24T13:05:39.874Z ERROR cache/disk_cache.go:101 get config from cache, cacheKey:data-id1.properties@@default@@public, cacheDir:/tmp/nacos/cache/config, error:open /tmp/nacos/cache/config/data-id1.properties@@default@@public: no such file or directory
2024-01-24T13:05:39.875Z ERROR cache/disk_cache.go:86 failed to delete config file,cache:/tmp/nacos/cache/config/data-id2.yml@@default@@public ,value: ,err:remove /tmp/nacos/cache/config/data-id2.yml@@default@@public: no such file or directory
2024-01-24T13:05:39.875Z ERROR cache/disk_cache.go:101 get config from cache, cacheKey:data-id2.yml@@default@@public, cacheDir:/tmp/nacos/cache/config, error:open /tmp/nacos/cache/config/data-id2.yml@@default@@public: no such file or directory

@junfengP
Copy link
Collaborator

看起来是nacos-sdk-go的相关错误,查看issue类似的有 nacos-group/nacos-sdk-go#316

集群中运行的nacos server是否添加了9848端口映射?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants