Skip to content

How to set the nodeSelector for deployment? #4779

Answered by rohanKanojia
hanming-nls asked this question in Q&A
Discussion options

You must be logged in to vote

NodeSelector seems to be in PodTemplate rather than DeploymentSpec:

   new DeploymentBuilder()
        .withNewMetadata()
          .withName("deploy1")
        .endMetadata()
        .withNewSpec()
          .withReplicas(1)
          .withNewSelector()
            .addToMatchLabels("app", "nginx")
          .endSelector()
          .withNewTemplate()
            .withNewSpec()
              .addNewContainer()
                .withName("nginx")
                .withImage("nginx:1.7.9")
                .addNewPort().withContainerPort(80).endPort()
              .endContainer()
              .addToNodeSelector("nodetype", "worker")
            .endSpec()
          .endTemplate()
        .e…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hanming-nls
Comment options

Answer selected by hanming-nls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants