Differences between revisions 11 and 12
Revision 11 as of 2019-11-03 21:58:01
Size: 1344
Editor: PieterSmit
Comment:
Revision 12 as of 2019-11-06 20:51:41
Size: 1518
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 50: Line 50:

== Add a sniffer as a sidecart to a pod ==
 * edit deployment and add {{{
- name: tcpdump
   image: corfr/tcpdump
   command:
     - /bin/sleep
     - infinity
}}}

Kubernetes K8s/Monitoring

  • Actual cpu usage, not requested

    $ kubectl get --raw /apis/metrics.k8s.io/v1beta1/pods
  • Events happening in cluser

    kubectl -n kube-system get events --sort-by='{.lastTimestamp}'
    
    kubectl -n kube-system get events -w
    
    kubectl get events --field-selector type=Warning -w &
    
    kubectl get pods -A -w -o wide | grep "^\|Running\|Terminating" &
  • Node cpu and memory utilization

    alias util='kubectl get nodes | grep node | awk '\''{print $1}'\'' | xargs -I {} sh -c '\''echo   {} ; kubectl describe node {} | grep Allocated -A 5 | grep -ve Event -ve Allocated -ve percent -ve -- ; echo '\'''
  • Watch node events (& puts it in background on terminal)

    kubectl get pods -A -o wide &
  • Get cpu metrics

    # CPU for singel pod
    kubectl top pod pd-691234f8-rabcw
    
    # Get the metrics for all nodes
    kubectl get --raw /apis/metrics.k8s.io/v1beta1/nodes | jq
    
    # Get the metrics for all pods
    kubectl get --raw /apis/metrics.k8s.io/v1beta1/pods | jq
    
    # Get metrics.
    kubectl get --raw /apis/metrics.k8s.io/v1beta1/namespaces/<namespace-name>/pods/<pod-name>

# k8s cluster auto scaler

kubectl -n kube-system describe configmap cluster-autoscaler-status

Add a sniffer as a sidecart to a pod

  • edit deployment and add

    - name: tcpdump
       image: corfr/tcpdump
       command:
         - /bin/sleep
         - infinity


CategoryK8sKubernetes

vigor: k8s/Monitoring (last edited 2020-04-16 20:32:17 by PieterSmit)