APISERVER=https://kubernetes.default.svc
# Path to ServiceAccount token
SERVICEACCOUNT=/var/run/secrets/kubernetes.io/serviceaccount
# Read this Pod's namespace
NAMESPACE=$(cat ${SERVICEACCOUNT}/namespace)
# Read the ServiceAccount bearer token
TOKEN=$(cat ${SERVICEACCOUNT}/token)
# Reference the internal certificate authority (CA)
CACERT=${SERVICEACCOUNT}/ca.crt
cat somebody.json | curl --cacert ${CACERT} -H "Authorization: Bearer ${TOKEN}" -H"Content-Type: application/json" -d @- -XPOST ${APISERVER}/api/v1/namespaces/${NAMESPACE}/configmaps