Deploying and using a Custom Kubernetes Scheduler

Consider, a client has a Kubernetes cluster and requires an additional scheduler for the pods with predefined labels. The new scheduler should work side-by-side with the built-in scheduler, and it should be deployed to the cluster. We'll deploy and use a custom Kubernetes scheduler and check how the schedulers work in the cluster. We need to ensure that the following steps are completed before deploying a Kubernetes scheduler: 

  • Use the random assignment scheduler from this exercise.
  • The scheduler container is already in Docker hub: onuryilmaz/k8sscheduler-example.
  • Use packt-scheduler as the custom scheduler name.
  • Show the status of the pods if the custom scheduler is not running.

You can find the pod.yaml file at: https://goo.gl/aCRppt.

Let's begin with the implementation:

  1. Create a pod with the custom scheduler name, defined as packt-scheduler:
kubectl apply -f k8s-scheduler-example/deploy/pod.yaml

After deploying the pod, its status can be checked:

kubectl get pods 

You should see the following output:

Since there is no scheduler deployed to the cluster with the name packt-scheduler, its status will be stuck as Pending forever.

  1. Deploy the scheduler into the cluster with the following command:
kubectl apply -f k8s-scheduler-example/deploy/scheduler.yaml 

You can find the scheduler.yaml file at: https://goo.gl/AaSu8o.

  1. Check the pods with the following command:
kubectl get pods

You'll get the following output:

As shown previously, the scheduler runs in a pod and, in addition, the nginx pod, which was Pending before, now has the Running status.

  1. In addition, check the logs of the scheduler:
 kubectl logs scheduler

You'll get the following output:

  1. Run the following command for cleaning up:
kubectl delete -f k8s-scheduler-example/deploy/pod.yaml
kubectl delete -f k8s-scheduler-example/deploy/scheduler.yaml

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.120.159