Allow scheduling of pods on Kubernetes master?

前端 未结 8 776
逝去的感伤
逝去的感伤 2020-12-03 06:54

I set up Kubernetes on CoreOS on bare metal using the generic install scripts. It\'s running the current stable release, 1298.6.0, with Kubernetes version 1.5.4.

We\

相关标签:
8条回答
  • 2020-12-03 07:24

    Allow scheduling of pods on the master

    kubectl taint node --all node-role.kubernetes.io/master:NoSchedule-
    

    Verify the master isn't tainted

    kubectl describe node | egrep -i taint
    

    Taints: <none>

    Schedule and run test pod in master

    kubectl run -it  busybox-$RANDOM --image=busybox --restart=Never -- date
    

    This answer is a combination of other SO answers, from Victor G, Aryak Sengupta, and others.

    0 讨论(0)
  • 2020-12-03 07:28

    I don't know why the master node shows up as NotReady; it shouldn't. Try executing kubectl describe node mymasternode to find out.

    The SchedulingDisabled is because the master node is tainted with dedicated=master:NoSchedule

    Execute this command against all your masters to remove the taint:

    kubectl taint nodes mymasternode dedicated-
    

    To understand why that works read up on taints and tolerations.

    0 讨论(0)
  • 2020-12-03 07:32

    Another way to list all taints in nodes and untaint the tainted one.

    root@lab-a:~# kubectl get nodes -o json | jq ".items[]|{name:.metadata.name, taints:.spec.taints}"
    {
      "name": "lab-a",
      "taints": null
    }
    {
      "name": "lab-b",
      "taints": [
        {
          "effect": "NoSchedule",
          "key": "node-role.kubernetes.io/master"
        }
      ]
    }
    

    lab-a does not have any taint. so we untaint lab-b:

    root@lab-a:~# k taint node lab-b node-role.kubernetes.io/master:NoSchedule-
    node/lab-b untainted
    

    Install jq in ubuntu by: apt-get install jq

    0 讨论(0)
  • 2020-12-03 07:32

    Since Openshift 4.x CoreOs is directly integrated on Kubernetes configuration (you can make all masters schedulable this way

    # edit the field spec.mastersSchedulable to set a value true
    $ oc patch schedulers.config.openshift.io cluster --type json \
         -p '[{"op": "add", "path": "/spec/mastersSchedulable", "value": true}]'
    

    or using

    oc edit schedulers.config.openshift.io cluster 
    

    and edit the field

    spec:
        mastersSchedulable: true
    
    0 讨论(0)
  • 2020-12-03 07:35

    First, get the name of the master

    kubectl get nodes
    
    NAME     STATUS   ROLES    AGE   VERSION
    yasin   Ready    master   11d   v1.13.4
    

    as we can see there is one node with the name of yasin and the role is master. If we want to use it as worker we should run

    kubectl taint nodes yasin node-role.kubernetes.io/master-
    
    0 讨论(0)
  • 2020-12-03 07:40

    Use the below command to untaint all masters

    kubectl taint nodes --all node-role.kubernetes.io/master-
    
    0 讨论(0)
提交回复
热议问题