로딩...

kubernetes-api

/apis/{api-group}/{api-version}/namespaces/{namespace}/{resource-plural}

# Point to the internal API server hostname
APISERVER=https://kubernetes.default.svc
SERVICEACCOUNT=/var/run/secrets/kubernetes.io/serviceaccount
NAMESPACE=$(cat ${SERVICEACCOUNT}/namespace)
TOKEN=$(cat ${SERVICEACCOUNT}/token)
CACERT=${SERVICEACCOUNT}/ca.crt
curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET ${APISERVER}/api
  • keyword 로 검색하면서 헤더를 함께 볼 수 있는 snippet
kubectl api-resources | head -n1; kubectl api-resources --verbs=list,get,create,update,patch,delete | unique | sort \
grep [SEARCH_KEYWORD]

command

  • kubectl rollout restart -n $NAMESPACE deptno
curl --cacert ${CACERT} -X PATCH -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/strategic-merge-patch+json" --data "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"kubectl.kubernetes.io/restartedAt\":\"$(date '+%Y-%m-%dT%H:%M:%S%:z')\"}}}}}" ${APISERVER}/apis/apps/v1/namespaces/${NAMESPACE}/deployments/deptno