python - kubernetes set value of service/status/loadBalance/ingress- ip -
i'm looking way set service/status/loadbalance/ingress-ip after creating k8s service of type=loadbalancer (as appears in 'type loadbalancer' section @ next link https://kubernetes.io/docs/concepts/services-networking/service/ ).
my problem similiar issue described in following link (is possible update kubernetes service 'external ip' while watching service? ) couldn't find answer.
thanks in advance
there's 2 ways this. json patch or merge patch. here's how latter:
[centos@ost-controller ~]$ cat patch.json { "status": { "loadbalancer": { "ingress": [ {"ip": "8.3.2.1"} ] } } }
now, here can see merge patches, have make dictionary containing object tree (begins @ status) need change merged. if wanted replace something, you'd have use json patch strategy.
once have file send request , if goes well, we'll receive response consisting on object merge applied:
[centos@ost-controller ~]$ curl --request patch --data "$(cat patch.json)" -h "content-type:application/merge-patch+json" http://localhost:8080/api/v1/namespaces/default/services/kubernetes/status{ "kind": "service", "apiversion": "v1", "metadata": { "name": "kubernetes", "namespace": "default", "selflink": "/api/v1/namespaces/default/services/kubernetes/status", "uid": "b8ece320-76c1-11e7-b468-fa163ea3fb09", "resourceversion": "2142242", "creationtimestamp": "2017-08-01t14:00:06z", "labels": { "component": "apiserver", "provider": "kubernetes" } }, "spec": { "ports": [ { "name": "https", "protocol": "tcp", "port": 443, "targetport": 6443 } ], "clusterip": "10.0.0.129", "type": "clusterip", "sessionaffinity": "clientip" }, "status": { "loadbalancer": { "ingress": [ { "ip": "8.3.2.1" } ] } }
wiki
Comments
Post a Comment