Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kube scheduler config not recognized #11179

Closed
didlawowo opened this issue Oct 27, 2024 · 3 comments
Closed

Kube scheduler config not recognized #11179

didlawowo opened this issue Oct 27, 2024 · 3 comments

Comments

@didlawowo
Copy link

i'm trying to setup kubescheduler inside my k3S cluster

Environmental Info:
K3s Version: 1.30

Node(s) CPU architecture, OS, and Version:
three arm64 node, and 2 amd64 node

Cluster Configuration:
"3 servers, 2 agents"

Describe the bug:
i want to apply a kube scheduler config but crd not exist:

# scheduler-config.yaml
apiVersion: kubescheduler.config.k8s.io/v1
kind: KubeSchedulerConfiguration
metadata:
  name: custom-scheduler-config
profiles:
- schedulerName: default-scheduler
  plugins:
    score:
      disabled:
      - name: NodeResourcesBalancedAllocation
      - name: NodeResourcesFit
      enabled:
      - name: NodePreferAvoid
        weight: 100
  pluginConfig:
  - name: NodePreferAvoid
    args:
      scoreStrategy:
        type: MostAllocated
        resources:
        - name: cpu
          weight: 1
        - name: memory
          weight: 1
      preferredNodes:
      - nodeSelectorTerms:
        - matchExpressions:
          - key: kubernetes.io/hostname
            operator: In
            values:
            - ryzen
      avoidNodes:
      - nodeSelectorTerms:
        - matchExpressions:
          - key: kubernetes.io/hostname
            operator: In
            values:
            - rtx

---
# Apply this to your kube-scheduler configuration in /etc/kubernetes/manifests/kube-scheduler.yaml
apiVersion: v1
kind: Pod
metadata:
  name: kube-scheduler
  namespace: kube-system
spec:
  containers:
  - name: kube-scheduler
    image: k8s.gcr.io/kube-scheduler:v1.30.0 # Use your cluster's version
    command:
    - kube-scheduler
    - --config=/etc/kubernetes/scheduler-config.yaml # Point to your config
    volumeMounts:
    - mountPath: /etc/kubernetes/scheduler-config.yaml
      name: scheduler-config
      readOnly: true
  volumes:
  - name: scheduler-config
    hostPath:
      path: /etc/kubernetes/scheduler-config.yaml
      type: File

Steps To Reproduce:
apply this config

Expected behavior:
existing crd

Actual behavior:
not exist

Additional context / logs:

The Kubernetes API could not find kubescheduler.config.k8s.io/KubeSchedulerConfiguration for requested resource kube-infra/custom-scheduler-config. Make sure the "KubeSchedulerConfiguration" CRD is installed on the destination cluster.
@brandond
Copy link
Member

brandond commented Oct 28, 2024

  1. This is a config file. You point the scheduler at it via the --config=/etc/kubernetes/scheduler-config.yaml arg. You do NOT apply it to the cluster.
  2. K3s does not run the scheduler in a pod, and does not store anything in /etc/kubernetes/manifests, so following instructions to modify pod manifests there is not correct. Are you following instructions written for a different Kubernetes distro? Also it looks like you ignored the instructions in the comments of the manifest you found.

Check the k3s docs for information on how to pass args to the scheduler: https://docs.k3s.io/cli/server#customized-flags-for-kubernetes-processes

@github-project-automation github-project-automation bot moved this from New to Done Issue in K3s Development Oct 28, 2024
@didlawowo
Copy link
Author

  1. This is a config file. You point the scheduler at it via the --config=/etc/kubernetes/scheduler-config.yaml arg. You do NOT apply it to the cluster.
  2. K3s does not run the scheduler in a pod, and does not store anything in /etc/kubernetes/manifests, so following instructions to modify pod manifests there is not correct. Are you following instructions written for a different Kubernetes distro? Also it looks like you ignored the instructions in the comments of the manifest you found.

Check the k3s docs for information on how to pass args to the scheduler: https://docs.k3s.io/cli/server#customized-flags-for-kubernetes-processes

there is no document in the link you provide custom args say nothing...

could you give a better document how to use that?

@brandond
Copy link
Member

In your example pod spec - from wherever you got that - it says:

    - kube-scheduler
    - --config=/etc/kubernetes/scheduler-config.yaml # Point to your config

For k3s, as the page I referenced says, you pass args to kube-scheduler via --kube-scheduler-arg. So you in the k3s config, you would want to set:

kube-scheduler-arg:
  - --config=/etc/kubernetes/scheduler-config.yaml # Point to your config

As the comment suggests you can put that scheduler config file wherever you want on the node, you just need to provide the correct path in the arg.

@k3s-io k3s-io locked and limited conversation to collaborators Oct 28, 2024
@brandond brandond converted this issue into discussion #11184 Oct 28, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
Status: Done Issue
Development

No branches or pull requests

2 participants