Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the practical scripts for automatic operation and maintenance of Kubernetes?

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces what Kubernetes practical automated operation and maintenance scripts have, which can be used for reference. Interested friends can refer to them. I hope you can learn a lot after reading this article.

FindEmptyNamespaces.sh

Iterate through all the namespaces in the cluster and find an empty namespace.

?. / findEmptyNamespaces.sh default

Kube-public

Online

Test

GetPodsTopCSV.sh

Get the cpu and memory usage of Pod written in CSV format file

? / getPodsTopCSV.sh-- help

. / getPodsTopCSV.sh-Get formatted results of kubectl top pod in a Kubernetes cluster for a selected namespace and pod in a CSV format

Usage:. / getPodsTopCSV.sh

-n |-namespace: Namespace to analyse. Default: default

-p |-pod: Pod to analyse.

-d |-- duration: Duration of sampling. Default: 0 (infinite)

-I |-interval: Interval between samples. Default: 5

-o |-- output: Output file. Default: top-.csv

-c |-containers: Output per container. Default: off

-Q |-- quite: Don't output to screen. Default: Output to screen

-h |-- help: Show this usage

-- no-headers: Don't print headers line

Examples:

=

Get for pod foo in namespace bar: $. / getPodsTopCSV.sh-namespace bar-pod foo

Get for pod foo in namespace bar and output to file foo.csv: $. / getPodsTopCSV.sh-- namespace bar-- pod foo-- output foo.csv

GetResourcesCSV.sh

Obtain all container resource requests and restrictions for each container in CSV format and standardize their values. The CSV format is very easy to automate and is ideal for pasting into Excel for further processing.

? / getResourcesCSV.sh-- help

. / getResourcesCSV.sh-Extract resource requests and limits in a Kubernetes cluster for a selected namespace or all namespaces in a CSV format

Usage:. / getResourcesCSV.sh

-n |-namespace: Namespace to analyse. Default:-- all-namespaces

-o |-- output: Output file. Default: resources.csv

-Q |-- quite: Don't output to screen. Default: Output to screen

-h |-- help: Show this usage

-- no-headers: Don't print headers line

Examples:

=

Get all: $. / getResourcesCSV.sh

Get for namespace foo: $. / getResourcesCSV.sh-- namespace foo

Get for namespace foo and use output file bar.csv: $. / getResourcesCSV.sh-namespace foo-output bar.csv

GetRestartingPods.sh

Gets all Pod (all or single namespaces) that have been detected to restart in one or more containers. The format is CSV.

? / getRestartingPods.sh-- help

. / getRestartingPods.sh-Extract resource requests and limits in a Kubernetes cluster for a selected namespace or all namespaces in a CSV format

Usage:. / getRestartingPods.sh

-n |-namespace: Namespace to analyse. Default:-- all-namespaces

-o |-- output: Output file. Default: restarting.csv

-Q |-- quite: Don't output to screen. Default: Output to screen

-h |-- help: Show this usage

-- no-headers: Don't print headers line

Examples:

=

Get all: $. / getRestartingPods.sh

Get for namespace foo: $. / getRestartingPods.sh-- namespace foo

Get for namespace foo and use output file bar.csv: $. / getRestartingPods.sh-namespace foo-output bar.csv

PodReady.sh

A simple script to check that Pod is really ready. Check that the status is running and all containers are ready. If ready, 0 is returned. If it is not ready, return 1.

PodReady.sh kube-flannel-ds-lf87p kube-system Thank you for reading this article carefully. I hope the article "what are the practical automated operation and maintenance scripts for Kubernetes" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report