본문 바로가기

Programming/Tip&Informaion

[Kubeflow/kserve] taints, tolerations 사용 시 에러

taint: 오점, 오명

toleration: 용인, 관용

 

특정 노드(node)에 특정 파드(pod)를 배포하기 위해서 알아보다 taints와 tolerations를 사용하라는 내용을 찾게 되었다.

익숙치 않는 단어라 검색해보니 위에 처럼 나와있다... (노드를 오염시켜 접근이 불가하지만 관용으로 접근한다는 건가..)

기능은 노드에 taints를 걸면 특정 조건(equal, exsist)이 맞을 경우 noSchedule, noExecute 등을 지정할 수 있다. 간단히 말해서 특정 값이 있는 경우에만 배포를 할 수 있다. (https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)

그리고 파드에 해당 조건을 주는 것이 tolerations 이다.

 

eksctl 기준 node 밑에 taints를 지정하면 되고, kubectl 기준 spec.predictor 밑에 tolerations를 지정하면 되는 것 같다.

 

지정하고 파드를 띄워봤는데 아래와 같은 에러가 발생했다.

 

Error from server (BadRequest): error when creating "service.yaml": admission webhook "validation.webhook.serving.knative.dev" denied the request: validation failed: must not set the field(s): spec.template.spec.nodeSelector, spec.template.spec.tolerations

 

찾아보니 tolerations를 사용하기 위해서 해당 기능을 켜야한다.

kubectl -n knative-serving edit cm config-features

로 직접 수정하는 방법도 있고

 kubectl patch configmap/config-features \
  --namespace knative-serving \
  --type merge \
  --patch '{"data":{"kubernetes.podspec-tolerations":"enabled"}}'

이런 식으로 kubectl로 처리도 가능한다.