亚欧色一区w666天堂,色情一区二区三区免费看,少妇特黄A片一区二区三区,亚洲人成网站999久久久综合,国产av熟女一区二区三区

  • 發布文章
  • 消息中心
點贊
收藏
評論
分享
原創

K8S腳本--Kubernetes集群的資源限制

2025-03-13 16:48:48
6
0

#!/bin/bash

# 配置參數
NAMESPACE="default"
LIMITS_FILE="/path/to/resource_limits.yaml"
LOG_FILE="/var/log/k8s_resource_limits.log"

# 檢查并創建日志文件
if [ ! -f "$LOG_FILE" ]; then
  touch "$LOG_FILE"
fi

# 記錄日志函數
log() {
  echo "$(date +"%Y-%m-%d %H:%M:%S") - $1" >> "$LOG_FILE"
}

# 檢查資源限制文件是否存在
if [ ! -f "$LIMITS_FILE" ]; then
  log "Error: Resource limits file $LIMITS_FILE does not exist."
  exit 1
fi

# 應用資源限制
log "Applying resource limits to namespace $NAMESPACE..."
kubectl apply -f "$LIMITS_FILE" -n "$NAMESPACE"

if [ $? -eq 0 ]; then
  log "Resource limits applied successfully to namespace $NAMESPACE."
else
  log "Failed to apply resource limits to namespace $NAMESPACE. Please check the logs for details."
  exit 1
fi

# 檢查資源限制是否生效
log "Checking resource limits status..."
kubectl describe limits -n "$NAMESPACE"

log "Resource limits setup completed successfully."

0條評論
0 / 1000
王****際
180文(wen)章數
2粉絲數
王****際
180 文章 | 2 粉(fen)絲
原創

K8S腳本--Kubernetes集群的資源限制

2025-03-13 16:48:48
6
0

#!/bin/bash

# 配置參數
NAMESPACE="default"
LIMITS_FILE="/path/to/resource_limits.yaml"
LOG_FILE="/var/log/k8s_resource_limits.log"

# 檢查并創建日志文件
if [ ! -f "$LOG_FILE" ]; then
  touch "$LOG_FILE"
fi

# 記錄日志函數
log() {
  echo "$(date +"%Y-%m-%d %H:%M:%S") - $1" >> "$LOG_FILE"
}

# 檢查資源限制文件是否存在
if [ ! -f "$LIMITS_FILE" ]; then
  log "Error: Resource limits file $LIMITS_FILE does not exist."
  exit 1
fi

# 應用資源限制
log "Applying resource limits to namespace $NAMESPACE..."
kubectl apply -f "$LIMITS_FILE" -n "$NAMESPACE"

if [ $? -eq 0 ]; then
  log "Resource limits applied successfully to namespace $NAMESPACE."
else
  log "Failed to apply resource limits to namespace $NAMESPACE. Please check the logs for details."
  exit 1
fi

# 檢查資源限制是否生效
log "Checking resource limits status..."
kubectl describe limits -n "$NAMESPACE"

log "Resource limits setup completed successfully."

文章來自個人專欄
文章 | 訂閱
0條評論
0 / 1000
請輸入你的評論
0
0