Skip to content

Commit

Permalink
Fix errors in configure-multiple-schedulers.md (kubernetes#8540)
Browse files Browse the repository at this point in the history
* Fix errors in configure-multiple-schedulers.md

- Failed to push docker image
- Errors found in my-scheduler logs
 
```
...
E0515 06:36:28.180428       1 reflector.go:205] k8s.io/kubernetes/vendor/k8s.io/client-go/informers/factory.go:130: Failed to list *v1beta1.ReplicaSet: replicasets.extensions is forbidden: User "system:serviceaccount:kube-system:default" cannot list replicasets.extensions at the cluster scope
```

* Replace double quote with backticks for code strings

* Use `system:kube-scheduler` instead of `cluster-admin`

* Create dedicated service account for `my-scheduler`
  • Loading branch information
yujunz authored and k8s-ci-robot committed Jun 4, 2018
1 parent 5c3fa99 commit d037453
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For more details, please read the GCR
[documentation](https://cloud.google.com/container-registry/docs/).

```shell
docker build -t my-kube-scheduler:1.0 .
docker build -t gcr.io/my-gcp-project/my-kube-scheduler:1.0 .
gcloud docker -- push gcr.io/my-gcp-project/my-kube-scheduler:1.0
```

Expand All @@ -63,6 +63,9 @@ config. Save it as `my-scheduler.yaml`:
An important thing to note here is that the name of the scheduler specified as an
argument to the scheduler command in the container spec should be unique. This is the name that is matched against the value of the optional `spec.schedulerName` on pods, to determine whether this scheduler is responsible for scheduling a particular pod.

Note also that we created a dedicated service account `my-scheduler` and bind the cluster role
`system:kube-scheduler` to it so that it can acquire the same privileges as `kube-scheduler`.

Please see the
[kube-scheduler documentation](/docs/admin/kube-scheduler/) for
detailed description of other command line arguments.
Expand Down
20 changes: 20 additions & 0 deletions content/en/docs/tasks/administer-cluster/my-scheduler.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-scheduler
namespace: kube-system
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: my-scheduler-as-kube-scheduler
subjects:
- kind: ServiceAccount
name: my-scheduler
namespace: kube-system
roleRef:
kind: ClusterRole
name: kube-scheduler
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -19,6 +38,7 @@ spec:
tier: control-plane
version: second
spec:
serviceAccountName: my-scheduler
containers:
- command:
- /usr/local/bin/kube-scheduler
Expand Down
2 changes: 1 addition & 1 deletion test/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func TestExampleObjectSchemas(t *testing.T) {
"memory-defaults-pod": {&api.Pod{}},
"memory-defaults-pod-2": {&api.Pod{}},
"memory-defaults-pod-3": {&api.Pod{}},
"my-scheduler": {&extensions.Deployment{}},
"my-scheduler": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &extensions.Deployment{}},
"namespace-dev": {&api.Namespace{}},
"namespace-prod": {&api.Namespace{}},
"persistent-volume-label-initializer-config": {&admissionregistration.InitializerConfiguration{}},
Expand Down

0 comments on commit d037453

Please sign in to comment.