美文网首页
Kubernetes 问题集锦

Kubernetes 问题集锦

作者: 香菜香菜我是折耳根 | 来源:发表于2020-03-06 20:45 被阅读0次

    1. 删除 Namespace 时卡住

    #!/bin/bash
    
    if [ -z "${1}" ] ; then
      echo -e "\nUsage: ${0} <name_of_the_namespace_to_remove_the_finalizer_from>\n"
      echo "Valid cluster names, based on your kube config:"
      kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}'
      exit 1
    fi
    
    kubectl proxy --port=8901 &
    PID=$!
    sleep 1
    
    echo -n 'Current context : '
    kubectl config current-context
    read -p "Are you sure you want to remove the finalizer from namespace ${1}? Press Ctrl+C to abort."
    
    kubectl get namespace "${1}" -o json \
                | jq '.spec.finalizers = [ ]' \
                | curl -k \
                -H "Content-Type: application/json" \
                -X PUT --data-binary @- "http://localhost:8901/api/v1/namespaces/${1}/finalize"
    
    kill -15 $PID
    

    https://github.com/kubernetes/kubernetes/issues/60807

    相关文章

      网友评论

          本文标题:Kubernetes 问题集锦

          本文链接:https://www.haomeiwen.com/subject/eeanrhtx.html