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

【ERROR】nacos-operator关于svc报错 #359

Open
Echo21bash opened this issue Nov 19, 2022 · 1 comment
Open

【ERROR】nacos-operator关于svc报错 #359

Echo21bash opened this issue Nov 19, 2022 · 1 comment

Comments

@Echo21bash
Copy link

nacos-operator容器报错

[root@k8s-master01 ~]# kubectl logs -f -n nacos nacos-operator-57b845c484-ntzsx 
I1119 04:52:07.853091       1 deleg.go:130] controller-runtime/metrics "msg"="metrics server is starting to listen"  "addr"=":8080"
I1119 04:52:07.854350       1 deleg.go:130] setup "msg"="starting manager"  
I1119 04:52:07.854710       1 leaderelection.go:243] attempting to acquire leader lease nacos/219866ca.nacos.io...
I1119 04:52:07.855436       1 deleg.go:130]  "msg"="starting metrics server"  "path"="/metrics"
I1119 04:52:25.048548       1 leaderelection.go:253] successfully acquired lease nacos/219866ca.nacos.io
I1119 04:52:25.051741       1 controller.go:165] controller/nacos "msg"="Starting EventSource" "reconciler group"="nacos.io" "reconciler kind"="Nacos" "source"={"Type":{"metadata":{"creationTimestamp":null},"spec":{"resources":{},"database":{},"volume":{},"k8sWrapper":{"PodSpec":{"containers":null}}},"status":{}}}
I1119 04:52:25.052064       1 controller.go:165] controller/nacos "msg"="Starting EventSource" "reconciler group"="nacos.io" "reconciler kind"="Nacos" "source"={"Type":{"metadata":{"creationTimestamp":null},"spec":{"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"containers":null}},"serviceName":"","updateStrategy":{}},"status":{"replicas":0}}}
I1119 04:52:25.052110       1 controller.go:173] controller/nacos "msg"="Starting Controller" "reconciler group"="nacos.io" "reconciler kind"="Nacos" 
I1119 04:52:25.215340       1 controller.go:207] controller/nacos "msg"="Starting workers" "reconciler group"="nacos.io" "reconciler kind"="Nacos" "worker count"=1
E1119 04:52:25.340999       1 nacos_controller.go:139] controllers/Nacos "msg"="unknow error" "error"="Service \"nacos-client\" is invalid: spec.ipFamilies[1]: Invalid value: []string(nil): ipfamily IPv6 is not configured on cluster"  
E1119 04:52:25.421729       1 nacos_controller.go:139] controllers/Nacos "msg"="unknow error" "error"="Service \"nacos-client\" is invalid: spec.ipFamilies[1]: Invalid value: []string(nil): ipfamily IPv6 is not configured on cluster"  
E1119 04:52:30.369076       1 nacos_controller.go:139] controllers/Nacos "msg"="unknow error" "error"="Service \"nacos-client\" is invalid: spec.ipFamilies[1]: Invalid value: []string(nil): ipfamily IPv6 is not configured on cluster"  
E1119 04:52:35.396815       1 nacos_controller.go:139] controllers/Nacos "msg"="unknow error" "error"="Service \"nacos-client\" is invalid: spec.ipFamilies[1]: Invalid value: []string(nil): ipfamily IPv6 is not configured on cluster"
[root@k8s-master01 ~]# kubectl get node
NAME           STATUS   ROLES    AGE   VERSION
k8s-master01   Ready    master   96d   v1.21.14
k8s-master02   Ready    master   96d   v1.21.14
k8s-master03   Ready    master   96d   v1.21.14
k8s-node01     Ready    node     96d   v1.21.14
k8s-node02     Ready    node     96d   v1.21.14
k8s-node03     Ready    node     96d   v1.21.14
k8s-node04     Ready    node     96d   v1.21.14
[root@k8s-master01 ~]# 
@huabanyu8411
Copy link

huabanyu8411 commented Dec 8, 2022

kubernetes version:1.21.1
nacos cluster version: 2.0.3
edit file nacos-k8s/operator/pkg/service/operator/Kind.go

func (e *KindClient) buildClientService(nacos *nacosgroupv1alpha1.Nacos) *v1.Service {
labels := e.generateLabels(nacos.Name, NACOS)
labels = e.MergeLabels(nacos.Labels, labels)

annotations := e.MergeLabels(e.generateAnnoation(), nacos.Annotations)

svc := &v1.Service{
	ObjectMeta: metav1.ObjectMeta{
		Name:        e.generateClientSvcName(nacos),
		Namespace:   nacos.Namespace,
		Labels:      labels,
		Annotations: annotations,
	},
	Spec: v1.ServiceSpec{
		PublishNotReadyAddresses: true,
		Ports: []v1.ServicePort{
			{
				Name:     "client",
				Port:     NACOS_PORT,
				Protocol: "TCP",
			},
		},
		Selector: labels,
	},
}
//client-service提供双栈
    //注释掉以下行
//var ipf = make([]v1.IPFamily, 0)
//ipf = append(ipf, v1.IPv4Protocol)
//ipf = append(ipf, v1.IPv6Protocol)
//svc.Spec.IPFamilies = ipf
//var ipPli = v1.IPFamilyPolicyPreferDualStack
//svc.Spec.IPFamilyPolicy = &ipPli
myErrors.EnsureNormal(controllerutil.SetControllerReference(nacos, svc, e.scheme))
return svc

}
docker build images

If you create nacos cluster ,It is work fine

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