paypal / load-watcher

Load watcher is a cluster-wide aggregator of metrics, developed for Trimaran: Real Load Aware Scheduler in Kubernetes.
Other
65 stars 34 forks source link

how to deploy the load-watcher as a service? #56

Open colocasia98 opened 1 year ago

colocasia98 commented 1 year ago

Hi all, I found this line in README: kubectl create -f manifests/load-watcher-deployment.yaml but I did not find the manifests/load-watcher-deployment.yaml in repo. Maybe a sample deployment file is needed? thanks.

lenhattan86 commented 1 year ago

load-watcher-deployment.yaml can be something like:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: load-watcher-deployment
  labels:
    app: load-watcher
spec:
  replicas: 1
  selector:
    matchLabels:
      app: load-watcher
  template:
    metadata:
      labels:
        app: load-watcher
    spec:
      containers:
      - name: load-watcher
        image: [load-watcher image]
        env:
        - name: METRICS_PROVIDER_NAME
          value: [eg. SignaFx]
        - name: METRICS_PROVIDER_ADDRESS
          value: [metrics_provider_endpoint]
        - name: METRICS_PROVIDER_TOKEN
          value: [token]
        - name: SIGNALFX_CLUSTER_NAME
          value: [cluster_name]
        ports:
        - containerPort: 2020
colocasia98 commented 1 year ago

Thanks a lot for your reply. Hope to add this file to the repo soon.

xiaooloong commented 11 months ago

you may need rbac if you are using metrics server

apiVersion: v1
kind: ServiceAccount
metadata:
  name: load-watcher
  namespace: loadwatcher
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: load-watcher-role
rules:
  - apiGroups: [""]
    resources: ["nodes"]
    verbs: ["get", "list", "watch"]
  - apiGroups: ["metrics.k8s.io"]
    resources: ["nodes"]
    verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: load-watcher-binding
subjects:
  - kind: ServiceAccount
    name: load-watcher
    namespace: loadwatcher
roleRef:
  kind: ClusterRole
  name: load-watcher-role
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: load-watcher-deployment
  namespace: loadwatcher
  labels:
    app: load-watcher
spec:
  replicas: 1
  selector:
    matchLabels:
      app: load-watcher
  template:
    metadata:
      labels:
        app: load-watcher
    spec:
      serviceAccountName: load-watcher
      containers:
      - name: load-watcher
        image: load-watcher:1
        ports:
        - containerPort: 2020
---
apiVersion: v1
kind: Service
metadata:
  namespace: loadwatcher
  name: load-watcher
  labels:
    app: load-watcher
spec:
  type: ClusterIP
  ports:
  - name: http
    port: 2020
    targetPort: 2020
    protocol: TCP
  selector:
    app: load-watcher