Kubectl修补程序返回“未修补”

时间:2018-08-01 20:12:31

标签: kubernetes yaml containers kubectl

我正在运行kubectl 1.7版

我正在尝试通过fig, ax = plt.subplots() np.random.seed(1) d1 = np.random.normal(size=5000) d2 = np.random.normal(scale=0.5, size=5000) x = d1 + d2 mdn = np.median(x) # draw the violinplot using matplotlib, storing the resulting dictionnary of artists result_dict = ax.violinplot(x, showextrema=False, showmedians=True) orig_violin = result_dict['bodies'][0] # in this case, there is only one violin plot, hence [0] orig_vertices = orig_violin.get_paths()[0].vertices # extract the vertices coordinates from the Path object contained in the PolyCollection top = orig_vertices[orig_vertices[:,1]>=mdn] # the vertices above the median bottom = orig_vertices[orig_vertices[:,1]<mdn] # and below # create new PolyCollections, adjusting their appearance as desired topP = matplotlib.collections.PolyCollection([top]) topP.set_facecolor('C1') bottomP = matplotlib.collections.PolyCollection([bottom]) bottomP.set_facecolor('C2') ax.add_collection(topP) ax.add_collection(bottomP) # remove the original(s) artists created by matplotlib's violinplot() [temp.remove() for temp in result_dict['bodies']] 将init容器添加到我的部署中,但是无论我如何尝试,它都会简单地返回“ not patched”。

kubectl patch 未修补部署“我的部署”

kubectl patch deployment my-deployment --patch "$(cat ./init-patch.yaml)"

这是为了允许自定义linux用户权限读写卷,而不需要成为root用户。

希望就为什么不对其进行补丁得到更好的答复。

2 个答案:

答案 0 :(得分:1)

Kubectl不是幂等的。如果要修补的元素已包含修补程序,则kubectl修补程序将失败。

可以在Natim的评论中阅读该解决方案,但是花了我一段时间才意识到这确实是我的问题。

答案 1 :(得分:0)

我有一个类似的问题,我的补丁甚至更简单:

$ kubectl patch deployment backoffice-deployment \
    --patch '{"spec":{"template":{"spec":{"containers":[{"name":"backoffice","image":"eu.gcr.io/ID/image:dev"}]}}}}' --v=7


I0924 18:59:37.260341   15253 loader.go:357] Config loaded from file ~/.kube    /config
I0924 18:59:37.267166   15253 round_trippers.go:384] GET https://35.205.207.230/apis/extensions/v1beta1/namespaces/default/deployments/backoffice-deployment
I0924 18:59:37.267181   15253 round_trippers.go:391] Request Headers:
I0924 18:59:37.267189   15253 round_trippers.go:394]     User-Agent: kubectl/v1.10.7 (linux/amd64) kubernetes/0c38c36
I0924 18:59:37.267196   15253 round_trippers.go:394]     Accept: application/json
I0924 18:59:37.323660   15253 round_trippers.go:409] Response Status: 200 OK in 56 milliseconds
I0924 18:59:37.326175   15253 round_trippers.go:384] PATCH https://35.205.207.230/apis/extensions/v1beta1/namespaces/default/deployments/backoffice-deployment
I0924 18:59:37.326217   15253 round_trippers.go:391] Request Headers:
I0924 18:59:37.326242   15253 round_trippers.go:394]     Content-Type: application/strategic-merge-patch+json
I0924 18:59:37.326265   15253 round_trippers.go:394]     User-Agent: kubectl/v1.10.7 (linux/amd64) kubernetes/0c38c36
I0924 18:59:37.326287   15253 round_trippers.go:394]     Accept: application/json
I0924 18:59:37.343313   15253 round_trippers.go:409] Response Status: 200 OK in 16 milliseconds
deployment.extensions "backoffice-deployment" not patched
F0924 18:59:37.349946   15253 helpers.go:119] 


$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.7", GitCommit:"0c38c362511b20a098d7cd855f1314dad92c2780", GitTreeState:"clean", BuildDate:"2018-08-20T10:09:03Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10+", GitVersion:"v1.10.7-gke.1", GitCommit:"7221ffe8776f399448d61b4dc9edb5c69232aece", GitTreeState:"clean", BuildDate:"2018-08-29T23:11:12Z", GoVersion:"go1.9.3b4", Compiler:"gc", Platform:"linux/amd64"}