简体   繁体   中英

Is there any method to set nodeselector for pod using golang api

Basically need a way to set nodeselector for Pod using GoLang API

Pod.Spec.NodeSelector["failure-domain.beta.kubernetes.io/zone"] = zone is giving out error

You should initialize the map before setting it. something like this

pod.Spec.NodeSelector = make(map[string]string)
pod.Spec.NodeSelector["failure-domain.beta.kubernetes.io/zone"] = "zone1"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM