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

Getting error in agent-clusternet in child clusternet #734

Open
shekhar250723 opened this issue Aug 30, 2023 · 7 comments
Open

Getting error in agent-clusternet in child clusternet #734

shekhar250723 opened this issue Aug 30, 2023 · 7 comments
Labels
invalid This doesn't seem right kind/question Further information is requested

Comments

@shekhar250723
Copy link

I am getting error in child-clusternet setup in GCP account.

Case 1- On my laptop
Getting below error in my GCP account.
Error: Kubernetes cluster unreachable: Get "https://104.197.186.74/version?timeout=32s": x509: certificate has expired or is not yet valid: current time 2023-08-30T17:38:06+05:30 is before 2023-08-30T12:45:29Z

Created new token but still getting error.

Note:- Parent cluster has been created in different project and child clusternet has been setup in different project.

Case 2- Different laptop
Getting error in child clusternet whenever tried to install agent-clusternet under of this. We are using child clusternet in different gcp and parent clusternet in different gcp account.

Agent-clusternet has been installed but getting below error in pod status

Error
kubectl get pod -n clusternet-system
NAME READY STATUS RESTARTS AGE
clusternet-agent-99d96988b-kclql 0/1 Error 2 (19s ago) 27s
clusternet-agent-99d96988b-kqd7x 0/1 Error 2 (19s ago) 27s
clusternet-agent-99d96988b-w7cjf 0/1 Error 2 (19s ago) 27s

Please help me on this.

@shekhar250723 shekhar250723 added the kind/bug Something isn't working label Aug 30, 2023
@dixudx
Copy link
Member

dixudx commented Aug 31, 2023

Error: Kubernetes cluster unreachable: Get "https://104.197.186.74/version?timeout=32s": x509: certificate has expired or is not yet valid: current time 2023-08-30T17:38:06+05:30 is before 2023-08-30T12:45:29Z

Actually it is NOT a problem of Clusternet.

The certificates of Kubernetes clusters got expired. You can try multiple ways to fix the expired certificates, such as

@dixudx dixudx added kind/question Further information is requested invalid This doesn't seem right and removed kind/bug Something isn't working labels Aug 31, 2023
@shekhar250723
Copy link
Author

shekhar250723 commented Sep 1, 2023

@dixudx It has been resolved automatically after the re-installation.

But I have some doubts. I have created one parent and 2 chilld cluster but whenever I tried to check the status of first child cluster through parent cluster then it's working fine but I got same status in another child cluster.

Second if I tried to switched the child cluster directly. Then I didn't check the created ns which I have created through parent cluster and getting error.

Error 1- Created the ns in first child cluster but it's also visible in another child cluster

$ kubectl clusternet --cluster-id=407df4f8-09f3-4353-bd13-0bbe23374669 --kubeconfig=.kube/config create ns developer-namespace
namespace/developer-namespace created

$ kubectl get clsrr
NAME                                              CLUSTER ID                             STATUS     AGE
clusternet-3ee7dab1-02c5-458d-8f3a-9e48d30af202   3ee7dab1-02c5-458d-8f3a-9e48d30af202   Approved   10m
clusternet-407df4f8-09f3-4353-bd13-0bbe23374669   407df4f8-09f3-4353-bd13-0bbe23374669   Approved   16h

$ kubectl clusternet --cluster-id=407df4f8-09f3-4353-bd13-0bbe23374669 --kubeconfig=.kube/config get ns
NAME                  STATUS   AGE
clusternet-9gw4k      Active   10m
clusternet-reserved   Active   16h
clusternet-system     Active   16h
clusternet-szc2b      Active   16h
default               Active   16h
developer-namespace   Active   19s
gmp-public            Active   16h
gmp-system            Active   16h
kube-node-lease       Active   16h
kube-public           Active   16h
kube-system           Active   16h

$ kubectl clusternet --cluster-id=3ee7dab1-02c5-458d-8f3a-9e48d30af202 --kubeconfig=.kube/config get ns
NAME                  STATUS   AGE
clusternet-9gw4k      Active   11m
clusternet-reserved   Active   16h
clusternet-system     Active   16h
clusternet-szc2b      Active   16h
default               Active   16h
developer-namespace   Active   26s
gmp-public            Active   16h
gmp-system            Active   16h
kube-node-lease       Active   16h
kube-public           Active   16h
kube-system           Active   16h 

Error 2- Getting error if I switched directly the child cluster and tried to check the created ns which is done by parent clusternet command.

$ kubectl clusternet get ns
Error from server (NotFound): Unable to list "/v1, Resource=namespaces": the server could not find the requested resource (get namespaces)

@dixudx
Copy link
Member

dixudx commented Sep 1, 2023

For error 1

It seems that the same cluster is registered twice.

For error 2

You are not specifying a valid kubeconfig. By default $HOME/.kube/config is used.

@shekhar250723
Copy link
Author

@dixudx As checked again, no same cluster has been registered twice. Could you please let me know any command? How can we check the status of it.

Second - Kubeconfig file is valid and updated the same as per the process but still getting the same error.

@dixudx
Copy link
Member

dixudx commented Sep 1, 2023

$ kubectl clusternet --cluster-id=407df4f8-09f3-4353-bd13-0bbe23374669 --kubeconfig=.kube/config get ns
NAME                  STATUS   AGE
clusternet-9gw4k      Active   10m
clusternet-reserved   Active   16h
clusternet-system     Active   16h
clusternet-szc2b      Active   16h
default               Active   16h
developer-namespace   Active   19s
gmp-public            Active   16h
gmp-system            Active   16h
kube-node-lease       Active   16h
kube-public           Active   16h
kube-system           Active   16h

$ kubectl clusternet --cluster-id=3ee7dab1-02c5-458d-8f3a-9e48d30af202 --kubeconfig=.kube/config get ns
NAME                  STATUS   AGE
clusternet-9gw4k      Active   11m
clusternet-reserved   Active   16h
clusternet-system     Active   16h
clusternet-szc2b      Active   16h
default               Active   16h
developer-namespace   Active   26s
gmp-public            Active   16h
gmp-system            Active   16h
kube-node-lease       Active   16h
kube-public           Active   16h
kube-system           Active   16h 

They have exactly the same output.
@shekhar250723 Where is the child kubeconfig? I did not see any --child-kubeconfig flag here. Would you please follow the guide strictly? Thanks.

Moreover, flag --kubeconfig and --child-kubeconfig are different, they are for different clusters. You can tell them from the flag name.

@shekhar250723
Copy link
Author

shekhar250723 commented Sep 4, 2023

@dixudx Sorry for that, but it's not working and clusternet.io documentation is incomplete. Child config command is not working properly.

$kubectl clusternet --cluster-id=59a4d6ab-14de-473c-8e1d-500bc5cdbe81 --kubeconfig=.kube/config  get ns
NAME                  STATUS   AGE
clusternet-gpv86      Active   18h
clusternet-reserved   Active   18h
clusternet-system     Active   18h
default               Active   42h
gmp-public            Active   42h
gmp-system            Active   42h
kube-node-lease       Active   42h
kube-public           Active   42h
kube-system           Active   42h
dev-link               Active   126m

Error

$ kubectl clusternet --cluster-id=59a4d6ab-14de-473c-8e1d-500bc5cdbe81 --child-kubeconfig=.kube/config get ns
error: the server doesn't have a resource type "ns"

--child-kubeconfig command not working

@dixudx
Copy link
Member

dixudx commented Sep 4, 2023

Firstly --child-kubeconfig and --kubeconfig are different flags. I am not meaning that you can only use either of them. Flag --kubeconfig will normally load from $HOME/.kube/config by default, unless you're explicitly specifying one.

If you're not clear about the default values, I'd suggest you adopt an explicit setting as follows,

$ kubectl clusternet --cluster-id=59a4d6ab-14de-473c-8e1d-500bc5cdbe81 --kubeconfig=[your parent cluster kubeconfig path]  --child-kubeconfig=[your child cluster kubeconfig path] get ns

Secondly, normally you should have different kubeconfig files for flag --kubeconfig and --child-kubeconfig respectively, unless you know exactly that you register parent cluster to itself as a child cluster.

Last but not the least, you can learn more from https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/, where you could have a better understanding of kubeconfig files, default locations, basic usages ,etc.

Currently what you've met now are solely Kubernetes usage problems. Please try to know exactly the command you're issuing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants