ovn-org / ovn-kubernetes

A robust Kubernetes networking platform
https://ovn-kubernetes.io/
Apache License 2.0
819 stars 339 forks source link

Error when trying to initialize libovsdb NB client #2634

Closed paupal1 closed 2 months ago

paupal1 commented 2 years ago

Trying to test up ovn-kubernetes locally to do some testing/experimentation. I ran into this and am unsure how to mitigate or continue. Would love any any pointers. db seems to be running on right ports 6641 & 6642.

NAME                             READY   STATUS             RESTARTS         AGE
ovnkube-db-799c74c94f-vpqcd      2/2     Running            0                69m
ovnkube-master-6dcdf7c48-78nsd   1/3     CrashLoopBackOff   16 (4m35s ago)   69m
ovnkube-node-92lz4               3/3     Running            10 (3m10s ago)   69m
ovnkube-node-wzrvg               3/3     Running            10 (2m57s ago)   69m
ovs-node-h9x96                   1/1     Running            0                65m
ovs-node-pd2hq                   1/1     Running            0                65m
F1108 23:13:11.646271      33 ovnkube.go:133] error when trying to initialize libovsdb NB client: failed to connect to tcp:172.29.0.5:6641: database OVN_Northbound validation error (9): Mapper Error. Object type nbdb.NBGlobal contains field HvCfgTimestamp (int) ovs tag hv_cfg_timestamp: Column does not exist in schema. Mapper Error. Object type nbdb.LogicalRouterPort contains field Ipv6Prefix ([]string) ovs tag ipv6_prefix: Column does not exist in schema. Mapper Error. Object type nbdb.LogicalRouterStaticRoute contains field BFD (*string) ovs tag bfd: Column does not exist in schema. Mapper Error. Object type nbdb.NAT contains field AllowedExtIPs (*string) ovs tag allowed_ext_ips: Column does not exist in schema. Mapper Error. Object type nbdb.Meter contains field Fair (*bool) ovs tag fair: Column does not exist in schema. Mapper Error. Object type nbdb.ForwardingGroup contains field ExternalIDs (map[string]string) ovs tag external_ids: Column does not exist in schema. database model contains a model for table BFD that does not exist in schema. Mapper Error. Object type nbdb.LoadBalancer contains field Options (map[string]string) ovs tag options: Column does not exist in schema. Mapper Error. Object type nbdb.LogicalRouterPolicy contains field ExternalIDs (map[string]string) ovs tag external_ids: Column does not exist in schema
andreaskaris commented 2 years ago

Hi @paupal1,

Object type nbdb.NBGlobal contains field HvCfgTimestamp (int) ovs tag hv_cfg_timestamp: Column does not exist in schema. Object type nbdb.LogicalRouterPort contains field Ipv6Prefix ([]string) ovs tag ipv6_prefix: Column does not exist in schema Object type nbdb.LogicalRouterStaticRoute contains field BFD (*string) ovs tag bfd: Column does not exist in schema. Mapper Error, etc.

Can you make sure that the version of OVN that you are using matches what ovn-kubernetes expects? Your errors indicate that your version of OVN is older than what ovn-kubernetes would expect, and it does not contain the required fields in its database.

E.g., for fedora, check the Dockerfile for a version of OVN that should work:

[akaris@linux ovn-kubernetes (master)]$ grep 'ARG ovn' ./dist/images/Dockerfile.fedora
ARG ovnver=ovn-21.09.0-3.fc33

Let's e.g. look at the model for LogicalRouterStaticRoute https://github.com/ovn-org/ovn-kubernetes/blob/master/go-controller/pkg/nbdb/logical_router_static_route.go

// LogicalRouterStaticRoute defines an object in Logical_Router_Static_Route table
type LogicalRouterStaticRoute struct {
    UUID        string                          `ovsdb:"_uuid"`
    BFD         *string                         `ovsdb:"bfd"`
    ExternalIDs map[string]string               `ovsdb:"external_ids"`
    IPPrefix    string                          `ovsdb:"ip_prefix"`
    Nexthop     string                          `ovsdb:"nexthop"`
    Options     map[string]string               `ovsdb:"options"`
    OutputPort  *string                         `ovsdb:"output_port"`
    Policy      *LogicalRouterStaticRoutePolicy `ovsdb:"policy"`
}

When you look at the OVN git blame, you can see that the BFD field was only added 10 months ago: https://github.com/ovn-org/ovn/blame/f6aba21c9de8952beccf7ee7e98cfa28618f1edf/ovn-nb.ovsschema#L417

Here: https://github.com/ovn-org/ovn/commit/6e0a69ad4bcdf9e4cace5c73ef48ab06065e8519

Regards,

Andreas

xfzhili commented 1 year ago

你好@paupal1,

Object type nbdb.NBGlobal contains field HvCfgTimestamp (int) ovs tag hv_cfg_timestamp: Column does not exist in schema. Object type nbdb.LogicalRouterPort contains field Ipv6Prefix ([]string) ovs tag ipv6_prefix: Column does not exist in schema Object type nbdb.LogicalRouterStaticRoute contains field BFD (*string) ovs tag bfd: Column does not exist in schema. Mapper Error, ETC。

你能确保你使用的 OVN 版本与 ovn-kubernetes 期望的相匹配吗?您的错误表明您的 OVN 版本比 ovn-kubernetes 预期的要旧,并且它的数据库中不包含必填字段。

例如,对于 fedora,检查 Dockerfile 中应该工作的 OVN 版本:

[akaris@linux ovn-kubernetes (master)]$ grep 'ARG ovn' ./dist/images/Dockerfile.fedora
ARG ovnver=ovn-21.09.0-3.fc33

让我们看看 LogicalRouterStaticRoute 的模型 https://github.com/ovn-org/ovn-kubernetes/blob/master/go-controller/pkg/nbdb/logical_router_static_route.go

// LogicalRouterStaticRoute defines an object in Logical_Router_Static_Route table
type LogicalRouterStaticRoute struct {
  UUID        string                          `ovsdb:"_uuid"`
  BFD         *string                         `ovsdb:"bfd"`
  ExternalIDs map[string]string               `ovsdb:"external_ids"`
  IPPrefix    string                          `ovsdb:"ip_prefix"`
  Nexthop     string                          `ovsdb:"nexthop"`
  Options     map[string]string               `ovsdb:"options"`
  OutputPort  *string                         `ovsdb:"output_port"`
  Policy      *LogicalRouterStaticRoutePolicy `ovsdb:"policy"`
}

查看OVN git blame,可以看到BFD字段是10个月前才添加的: https://github.com/ovn-org/ovn/blame/f6aba21c9de8952beccf7ee7e98cfa28618f1edf/ovn-nb.ovsschema#L417

这里:ovn-org/ovn@ 6e0a69a

问候,

安德烈亚斯

3637

have similar issues。 but my ovn version is newer。 please help me

i can not find such as table Mirror in ubuntu:22.04, is it a bug? i need copy ovn bin file to container? https://manpages.ubuntu.com/manpages/jammy/man5/ovn-nb.5.html#nat%20table

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 2 months ago

This issue was closed because it has been stalled for 5 days with no activity.