2
Some checks failed
Sync Consul Config / sync (push) Failing after 2m12s

This commit is contained in:
xiaolipro 2026-09-21 16:57:32 +08:00
parent aae640d675
commit f9b6b93064
3 changed files with 10 additions and 6 deletions

View File

@ -22,7 +22,7 @@ jobs:
case "$TARGET" in case "$TARGET" in
test) test)
export KUBECONFIG=/root/.kube/k3s-test.yaml export KUBECONFIG=/etc/rancher/k3s/k3s-test.yaml
export NAMESPACE=test export NAMESPACE=test
;; ;;
*) *)
@ -30,7 +30,11 @@ jobs:
export NAMESPACE=prod export NAMESPACE=prod
;; ;;
esac esac
test -f "$KUBECONFIG" if [[ ! -f "$KUBECONFIG" ]]; then
echo "FAIL: missing KUBECONFIG=$KUBECONFIG host=$(hostname) uid=$(id -u)"
ls -la /etc/rancher/k3s/ /root/.kube/ 2>/dev/null || true
exit 1
fi
export RESTART_APIS=1 export RESTART_APIS=1
REPO="${{ gitea.repository }}" REPO="${{ gitea.repository }}"

View File

@ -35,7 +35,7 @@ kubectl -n prod create secret generic jwt-secret \
--dry-run=client -o yaml | kubectl apply -f - --dry-run=client -o yaml | kubectl apply -f -
# test(也可用 secrets.yaml 里 prod-credentials 的 JWT_SECRET_KEY) # test(也可用 secrets.yaml 里 prod-credentials 的 JWT_SECRET_KEY)
kubectl --kubeconfig=/root/.kube/k3s-test.yaml -n test \ kubectl --kubeconfig=/etc/rancher/k3s/k3s-test.yaml -n test \
create secret generic jwt-secret \ create secret generic jwt-secret \
--from-literal=JWT_SECRET_KEY='ideship-jwt-secret-test-change-me' \ --from-literal=JWT_SECRET_KEY='ideship-jwt-secret-test-change-me' \
--dry-run=client -o yaml | kubectl apply -f - --dry-run=client -o yaml | kubectl apply -f -
@ -57,7 +57,7 @@ git push -u origin master # → prod Consul
git push -u origin test # → test Consul git push -u origin test # → test Consul
``` ```
Runner 标签需含 `k3s-host`;134 上需有 `/root/.kube/k3s-test.yaml`。 Runner 标签需含 `k3s-host`;134 上需有 `/etc/rancher/k3s/k3s-test.yaml`。
### 4. 与线上对账(推荐先做) ### 4. 与线上对账(推荐先做)
@ -80,7 +80,7 @@ export KUBECONFIG=/etc/rancher/k3s/k3s.yaml NAMESPACE=prod
./scripts/sync-to-consul.sh ./scripts/sync-to-consul.sh
# test # test
export KUBECONFIG=/root/.kube/k3s-test.yaml NAMESPACE=test export KUBECONFIG=/etc/rancher/k3s/k3s-test.yaml NAMESPACE=test
./scripts/sync-to-consul.sh ./scripts/sync-to-consul.sh
``` ```

View File

@ -129,7 +129,7 @@ echo "==> 加载密钥(K8s Secret / env) ns=${NS} kubeconfig=${KUBECONFIG}"
if ! kubectl -n "$NS" get secret prod-credentials >/dev/null 2>&1; then if ! kubectl -n "$NS" get secret prod-credentials >/dev/null 2>&1; then
echo "FAIL: 找不到 secret/${NS}/prod-credentials" echo "FAIL: 找不到 secret/${NS}/prod-credentials"
echo " 当前: KUBECONFIG=${KUBECONFIG}" echo " 当前: KUBECONFIG=${KUBECONFIG}"
echo " test 集群请先: kubectl --kubeconfig=/root/.kube/k3s-test.yaml apply -f /data/k3s-test/manifests/secrets.yaml" echo " test 集群请先: kubectl --kubeconfig=/etc/rancher/k3s/k3s-test.yaml apply -f /data/k3s-test/manifests/secrets.yaml"
echo " 或: kubectl -n ${NS} get secret" echo " 或: kubectl -n ${NS} get secret"
exit 1 exit 1
fi fi