python icon indicating copy to clipboard operation
python copied to clipboard

Please can you provide an example of node_selector in V1PodSpec

Open dw86uk opened this issue 2 years ago • 4 comments

Please can you provide an example of node_selector in V1PodSpec please?

I'm struggling to use it

dw86uk avatar Oct 22 '22 12:10 dw86uk

/help

yliaog avatar Oct 24 '22 16:10 yliaog

@yliaog: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Oct 24 '22 16:10 k8s-ci-robot

Hi @dw86uk Is this example what you want?

  container = client.V1Container(
      name="nginx",
      image="nginx"
  )
  # Create the specification of pod
  spec = client.V1PodSpec(
      restart_policy="Never", 
      containers=[container], 
      node_selector={"kubernetes.io/hostname": "slave-2"}
  )

showjason avatar Oct 27 '22 14:10 showjason

@k8s-ci-robot hello, can I help in solving this issue?

MashiatK avatar Feb 06 '23 17:02 MashiatK