hereを見ると、複数のKubernetesクライアントが多数の言語で存在します。 PythonとGoは正式にサポートされています。クライアントを呼び出すことで、手順を自動化できます。
Pythonを知っている場合は、下記のsampleを参照してください。内部と外部のAPIを利用に関して、
from __future__ import print_statement
import time
import kubernetes.client from kubernetes.client.rest
import ApiException from pprint import pprint
# Configure API key authorization: BearerToken
kubernetes.client.configuration.api_key['authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# kubernetes.client.configuration.api_key_prefix['authorization'] = 'Bearer'
# create an instance of the API class api_instance =
kubernetes.client.CoreV1Api()
name = 'name_example' # str | name of the ConfigMap
namespace = 'namespace_example' # str | object name and auth scope, such as for teams and projects
body = NULL # object |
pretty = 'pretty_example' # str | If 'true', then the output is pretty printed. (optional)
try:
api_response = api_instance.patch_namespaced_config_map(name, namespace, body, pretty=pretty)
pprint(api_response)
except ApiException as e:
print("Exception when calling CoreV1Api->patch_namespaced_config_map: %s\n" % e)
、あなたはwikiを見てみることができます。特にこのthreadは、ポッドからAPIにアクセスする方法を説明しています。
KUBE_TOKEN=$(</var/run/secrets/kubernetes.io/serviceaccount/token)
curl -sSk -H "Authorization: Bearer $KUBE_TOKEN" https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCP_PORT/api/v1/namespaces/iot2cloud/configmaps