<p>I'm working on a python script for update the configmaps programmatically.</p>

<p>Example script at shown as below. </p>

<pre><code>import requests

headers = {"Content-Type": "application/json-patch+json"}
configData = {
"apiVersion": "v1",
"kind": "ConfigMap",
"data": {
    "test2.load": "testimtest"
},
"metadata": {
    "name": "nginx2"
}
}

r = requests.patch("http://localhost:8080/api/v1/namespaces/default/configmaps/nginx2", json=configData)
</code></pre>

<p>The interesting side of this problem is that I have no problem with POST and GET methods but when I want to update kubernetes configmaps with PATCH method of HTTP I'm getting </p>

<pre><code> "reason":"UnsupportedMediaType" //STATUS_CODE 415
</code></pre>

<p>How I can handle this problem. </p>

ColossusMark1
<p>I suggest you use a Kubernetes client library, instead of making the raw HTTP calls yourself. Then you don't need to figure out the low-level connection stuff, as the library will abstract that away for you.</p>

<p>I've been using <a href="https://github.com/kelproject/pykube" rel="nofollow noreferrer">Pykube</a>, which provides a nice pythonic API, though it does appear to be abandoned now.</p>

<p>You can also use the official <a href="https://github.com/kubernetes-client/python" rel="nofollow noreferrer">client-python</a>, which is actively maintained. The library is a bit more clunky, as it's based on an autogenerated OpenAPI client, but it covers lots of use-cases like streaming results.</p>
