logo
Tags down

shadow

How to adjust the output of kubectl get pods in kubernetes to watch pods status


By : user13540
Date : October 14 2020, 02:21 PM
may help you . You can re-arrange the output with awk which loses the pretty column separation but you can then make it pretty again with column:
kubectl get pods -n dataspace -o wide | sort -k7 | awk '{ print $1, $2, $3, $7, $4, $5, $6}' | column -t
code :


Share : facebook icon twitter icon

Kubernetes kubectl shows pods restarts as zero but pods age has changed


By : chrisrde
Date : March 29 2020, 07:55 AM
I wish this help you Can somebody explain why the following command shows that there have been no restarts but the age is 2 hours when it was started 17 days ago , There are two things that might happen:
code :
$ kubectl describe deployment <deployment_name>  
...
Events:
  Type    Reason             Age   From                   Message
  ----    ------             ----  ----                   -------
  Normal  ScalingReplicaSet  1m    deployment-controller  Scaled up replica set testdep1-75488876f6 to 1
  Normal  ScalingReplicaSet  1m    deployment-controller  Scaled down replica set testdep1-d4884df5f to 0
kubectl describe nodes <node_name>
...
 Type    Reason                   Age                From                   Message
  ----    ------                   ----               ----                   -------
  Normal  Starting                 32s                kubelet, <node-name>     Starting kubelet.
  Normal  NodeHasSufficientPID     31s (x5 over 32s)  kubelet, <node-name>     Node <node-name> status is now: NodeHasSufficientPID
  Normal  NodeAllocatableEnforced  31s                kubelet, <node-name>     Updated Node Allocatable limit across pods
  Normal  NodeHasSufficientDisk    30s (x6 over 32s)  kubelet, <node-name>     Node <node-name> status is now: NodeHasSufficientDisk
  Normal  NodeHasSufficientMemory  30s (x6 over 32s)  kubelet, <node-name>     Node <node-name> status is now: NodeHasSufficientMemory
  Normal  NodeHasNoDiskPressure    30s (x6 over 32s)  kubelet, <node-name>     Node <node-name> status is now: NodeHasNoDiskPressure
  Normal  Starting                 10s                kube-proxy, <node-name>  Starting kube-proxy.

Kubectl command to list pods of a deployment in kubernetes


By : frenchie
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further There's a label in the pod for the selector in the deployment. That's how a deployment manages its pods. For example for the label or selector app=http-svc you can do something like that this and avoid using grep and listing all the pods (this becomes useful as your number of pods becomes very large):
code :
$ kubectl get pods -l=app=http-svc
$ kubectl get pods --selector=app=http-svc

Prevent Kubernetes breaking (kubectl does not respond) when too many Pods


By : user2060949
Date : March 29 2020, 07:55 AM
hop of those help? The fact that it takes a long time to list your pods is not really about your nodes as they will able to handle pods as much depending on the resources they have such CPUs and Memory.
The issue you are seeing is more about the kubeapi-server being able query/reply a large number of pods or resources.

Kubernetes - display current pods vs. capacity with kubectl


By : user3249835
Date : March 29 2020, 07:55 AM
around this issue There is no one command for this.
It is possible to write script to do that with combining those two commands.
code :
kubectl describe node | grep -E "(^Name:|^Non-terminated)"

Kubernetes: kubectl top nodes/pods not working


By : friendimaginary
Date : March 29 2020, 07:55 AM
will be helpful for those in need There are two ways to fix this problem:
1) using heapster : installing heapster will allow 'kubectl top nodes' to work out of the box. However heapster has been deprecated, so you probably should switch to metrics-server.
code :
containers:
- name: metrics-server
  image: k8s.gcr.io/metrics-server-amd64:v0.3.1
  imagePullPolicy: Always
  volumeMounts:
  - name: tmp-dir
    mountPath: /tmp

  command:
      - /metrics-server
      - --kubelet-insecure-tls
      - --kubelet-preferred-address-types=InternalIP
shadow
Privacy Policy - Terms - Contact Us © voile276.org