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

karmadactl output format with more information such as -owide #1219

Closed
Chenhb123 opened this issue Jan 6, 2022 · 14 comments · Fixed by #1270
Closed

karmadactl output format with more information such as -owide #1219

Chenhb123 opened this issue Jan 6, 2022 · 14 comments · Fixed by #1270
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@Chenhb123
Copy link

Please provide an in-depth description of the question you have:
After I added multiple external clusters in Karmada, I can view cluster resource information using the karmadactl command without having to switch contexts or specify configuration files,This becomes more and more useful👍 when there are more and more clusters:

root@stor01[karmada]# export KUBECONFIG=/root/.kube/karmada.config
root@stor01[karmada]# karmadactl get po
The karmadactl get command now only supports Push mode, [ karmada-apiserver ] are not push mode

NAME                                      CLUSTER               READY   STATUS    RESTARTS   AGE
nfs-client-provisioner-788786ff4d-5wznv   kubernetes-admin144   1/1     Running   0          7d1h
web-0                                     kubernetes-admin144   1/1     Running   0          85m
web-1                                     kubernetes-admin144   1/1     Running   0          85m
nginx-86c57db685-4t2ks                    localhost             1/1     Running   0          42m
nginx-86c57db685-9gdn9                    localhost             1/1     Running   0          42m
nginx-86c57db685-dnc85                    localhost             1/1     Running   0          42m
nginx-789fb764bf-5qvgj                    member1               0/1     Pending   0          42m
nginx-789fb764bf-k24tb                    member1               0/1     Pending   0          42m
nginx-789fb764bf-xx6gh                    member1               0/1     Pending   0          42m
root@stor01[karmada]# karmadactl get po -C=localhost
NAME                     CLUSTER     READY   STATUS    RESTARTS   AGE
nginx-86c57db685-4t2ks   localhost   1/1     Running   0          42m
nginx-86c57db685-9gdn9   localhost   1/1     Running   0          42m
nginx-86c57db685-dnc85   localhost   1/1     Running   0          42m

However, when I tried to use Karmadactl to get resource details, I ran into a problem. In k8s, you can use specific commands to query resource details:

root@stor01[karmada]# kubectl --kubeconfig=/root/.kube/config get po -owide
NAME                     READY   STATUS    RESTARTS   AGE   IP            NODE     NOMINATED NODE   READINESS GATES
nginx-86c57db685-4t2ks   1/1     Running   0          55m   10.244.1.25   stor02   <none>           <none>
nginx-86c57db685-9gdn9   1/1     Running   0          55m   10.244.2.59   stor03   <none>           <none>
nginx-86c57db685-dnc85   1/1     Running   0          55m   10.244.1.26   stor02   <none>           <none>
root@stor01[karmada]# kubectl --kubeconfig=/root/.kube/config describe po nginx-86c57db685-4t2ks
Name:         nginx-86c57db685-4t2ks
Namespace:    default
Priority:     0
Node:         stor02/10.10.236.173
Start Time:   Wed, 05 Jan 2022 16:00:49 +0800
Labels:       app=nginx
              pod-template-hash=86c57db685
Annotations:  <none>
Status:       Running
IP:           10.244.1.25
IPs:
  IP:           10.244.1.25
Controlled By:  ReplicaSet/nginx-86c57db685
Containers:
  nginx:
    Container ID:   docker://39424deee113cc8e909f7f7719654ff6839fcf15f2f00913e440161b84002fdc
    Image:          nginx
    Image ID:       docker-pullable://nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31
    Port:           <none>
    Host Port:      <none>
    State:          Running
      Started:      Wed, 05 Jan 2022 16:01:05 +0800
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-kbfjf (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  default-token-kbfjf:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-kbfjf
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  55m   default-scheduler  Successfully assigned default/nginx-86c57db685-4t2ks to stor02
  Normal  Pulling    55m   kubelet, stor02    Pulling image "nginx"
  Normal  Pulled     55m   kubelet, stor02    Successfully pulled image "nginx"
  Normal  Created    55m   kubelet, stor02    Created container nginx
  Normal  Started    55m   kubelet, stor02    Started container nginx
root@stor01[karmada]#

Therefore, I want to know whether karmadactl will increase the function of viewing resource details to avoid complex command operations under multiple clusters. thanks.
What do you think about this question?:
Hope it will increase the function of viewing resource details such as karmadactl describe po web-0 -C=member1 -n default
Environment:

  • Karmada version:
root@stor01[karmada]# karmadactl version
karmadactl version: version.Info{GitVersion:"v0.0.0-master", GitCommit:"unknown", GitTreeState:"unknown", BuildDate:"unknown", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}
root@stor01[/home/chb/karmada/samples/nginx]#
  • Kubernetes version:
root@stor01[karmada]# kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.4", GitCommit:"8d8aa39598534325ad77120c120a22b3a990b5ea", GitTreeState:"clean", BuildDate:"2020-03-12T21:03:42Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.7", GitCommit:"1f86634ff08f37e54e8bfcd86bc90b61c98f84d4", GitTreeState:"clean", BuildDate:"2021-11-17T14:35:38Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}
  • Others:
@Chenhb123 Chenhb123 added the kind/question Indicates an issue that is a support question. label Jan 6, 2022
@RainbowMango
Copy link
Member

Good question! I think it's a very useful feature.

cc @lonelyCZ @lfbear Any comments?

@lonelyCZ
Copy link
Member

lonelyCZ commented Jan 6, 2022

Greate! I consider we could enhance karmadactl get that aggregate apiserver has been merged and provide more subcommands.

@lfbear
Copy link
Member

lfbear commented Jan 6, 2022

@QAQ-rookie How about this feature :)

@Chenhb123
Copy link
Author

@RainbowMango Thank you very much for your reply and look forward to the update of this function☀️

@RainbowMango
Copy link
Member

You are welcome! Thanks for reaching us though.

@GitHubxsy
Copy link
Contributor

apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://10.0.0.1:5443
  name: karmada-apiserver
- cluster:
    insecure-skip-tls-verify: true
    server: https://10.0.0.1:5443/apis/cluster.karmada.io/v1alpha1/cluster/member1/proxy
  name: member1
- cluster:
    insecure-skip-tls-verify: true
    server: https://10.0.0.1:5443/apis/cluster.karmada.io/v1alpha1/cluster/member2/proxy
  name: member2
- cluster:
    insecure-skip-tls-verify: true
    server: https://10.0.0.1:5443/apis/cluster.karmada.io/v1alpha1/cluster/member3/proxy
  name: member3
contexts:
- context:
    cluster: karmada-apiserver
    user: karmada-user
  name: karmada-user
current-context: karmada-apiserver
kind: Config
preferences: {}
users:
- name: karmada-user
  user:
    client-certificate-data: data
    client-key-data: data
  • step3:use
    Get nodes in member1 cluster : kubectl get node -owide --cluster=member1
    Get pods in member2 cluster: kubectl get pod -owide --cluster=member2

The above we currently have capabilities.We can further optimize:

  1. User does not need to generate kubeconfig
  2. use karmadactl to obtain objects from multiple clusters at the same time, such as:
    karmadactl get pod -owide --cluster=member1,member2
    karmadactl get pod --all-clusters

@lonelyCZ
Copy link
Member

The above we currently have capabilities.We can further optimize:

  1. User does not need to generate kubeconfig
  2. use karmadactl to obtain objects from multiple clusters at the same time, such as:
    karmadactl get pod -owide --cluster=member1,member2
    karmadactl get pod --all-clusters

I would like to optimize it.

/assign

@RainbowMango
Copy link
Member

Thanks @lonelyCZ
I'm going to promote this question to feature
/remove-kind question
/kind feature

And I'll put this to release 1.1.

@karmada-bot karmada-bot added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/question Indicates an issue that is a support question. labels Jan 14, 2022
@RainbowMango RainbowMango added this to the v1.1 milestone Jan 14, 2022
@lonelyCZ
Copy link
Member

1.User does not need to generate kubeconfig

I consider a strategy that the member cluster proxy kubeconfig have been auto generated when install Karmada like karmada-apiserver.

2.use karmadactl to obtain objects from multiple clusters at the same time

Do we need to replace secret with proxy to access resource in member cluster directly?

Hi, @RainbowMango @GitHubxsy How do you think?

@GitHubxsy
Copy link
Contributor

1.User does not need to generate kubeconfig

I consider a strategy that the member cluster proxy kubeconfig have been auto generated when install Karmada like karmada-apiserver.

2.use karmadactl to obtain objects from multiple clusters at the same time

Do we need to replace secret with proxy to access resource in member cluster directly?

Hi, @RainbowMango @GitHubxsy How do you think?

I think we need to obtain user authorization before we can access the member cluster. How to handle authorization is the most critical step.

@lonelyCZ
Copy link
Member

I think we need to obtain user authorization before we can access the member cluster. How to handle authorization is the most critical step.

Right, it is important to handle authorization. But it is inconveniently to let users to create authorization config every time. So for admin users, joining a member cluster that can create a proxy kubeconfig like kubectl join nodes that have all permissions.

How do you think put this process in karmadactl join?

@GitHubxsy
Copy link
Contributor

When the command output displays "Forbidden", prompt the user for authorization.
For example:

#karmadactl  get pods --cluster=cluster1
forbidden. Need authorization: karmadactl auth --user="system:admin"
Then, retry.

@GitHubxsy
Copy link
Contributor

@lonelyCZ This feature can be developed based on the situation that users have been authorized to access all member clusters.
Regarding authorization, we provide documentation or better ways to inform users.

@lonelyCZ
Copy link
Member

@GitHubxsy Ok, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants