How to require one pod per minion/kublet when configuring a replication controller?

后端 未结 3 754
情深已故
情深已故 2021-01-06 11:59

I have 4 nodes (kubelets) configured with a label role=nginx

master ~ # kubectl get node
NAME          LABELS                               


        
相关标签:
3条回答
  • 2021-01-06 12:31

    Prior to DaemonSet being available, you can also specify that you pod uses a host port and set the number of replicas in your replication controller to something greater than your number of nodes. The host port constraint will allow only one pod per host.

    0 讨论(0)
  • 2021-01-06 12:44

    Replication controller doesn't guarantee one pod per node as the scheduler will find the best fit for each pod. I think what you want is the DaemonSet controller, which is still under development. Your workaround posted above would work too.

    0 讨论(0)
  • 2021-01-06 12:55

    I was able to achieve this by modifying the labels as follows below

    master ~ # kubectl get nodes -o wide
    NAME          LABELS                                           STATUS
    10.1.141.34   kubernetes.io/hostname=10.1.141.34,role=nginx1   Ready
    10.1.141.40   kubernetes.io/hostname=10.1.141.40,role=nginx2   Ready
    10.1.141.42   kubernetes.io/hostname=10.1.141.42,role=nginx3   Ready
    10.1.141.43   kubernetes.io/hostname=10.1.141.43,role=nginx4   Ready
    

    I then created 4 nginx replication controllers each referencing the nginx{1|2|3|4} roles and labels.

    0 讨论(0)
提交回复
热议问题