kubectl tips

更新 CR Status 字段

参考 Update K8s CR Status

强制删除 Namespace

参考 force-delete-namespace.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env bash

set -e
set -o pipefail

kubectl proxy &
proxy_pid="$!"
trap 'kill "$proxy_pid"' EXIT

for ns in $(kubectl get namespace --field-selector=status.phase=Terminating --output=jsonpath="{.items[*].metadata.name}"); do
echo "Removing finalizers from namespace '$ns'..."
curl -H "Content-Type: application/json" -X PUT "127.0.0.1:8001/api/v1/namespaces/$ns/finalize" -d @- \
< <(kubectl get namespace "$ns" --output=json | jq '.spec = { "finalizers": [] }')

echo
echo "Force-deleting namespace '$ns'..."
kubectl delete namespace "$ns" --force --grace-period=0 --ignore-not-found=true
done

Maven Mirrors

Huawei

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<repositories>
<repository>
<id>hw</id>
<name>hw</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>hw</id>
<name>hw</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</pluginRepository>
</pluginRepositories>