How to create Harvest in K8s? #1913
-
Hello I only want to install Harvest and collect data on this Prometheus. If someone has had success with configuring it, can you share me how? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 3 replies
-
@wooyoungAhn Harvest can be installed on k8. There are reference documents here and a discussion. If you looking for a k8 operator, Please +1 issue here. |
Beta Was this translation helpful? Give feedback.
-
Hello @rahulguptajss Does this only work on local k8s? I am not the admin of k8. (This is not my k8.) Is there any way to configure it using public image? I did the below but it didn't work.
log.. 2023-04-10T08:22:41Z ERR ./poller.go:166 > Unable to read config error="read /opt/harvest.yml: is a directory" Poller=mytestcvo config=/opt/harvest.yml harvest=harvest
2023-04-10T08:22:41Z INF ./poller.go:546 > cleaning up and stopping [pid=1] harvest=harvest
error reading config file=[/opt/harvest.yml] read /opt/harvest.yml: is a directory |
Beta Was this translation helpful? Give feedback.
-
@wooyoungAhn Yes, these steps are for local k8s only, but the steps shouldn't change much even for cloud deployment. You need to modify the volume mounts accordingly. I see from your kub.yaml that the volume mount paths are missing. Harvest is unable to find its configuration file at /opt/harvest.yaml. Below is my kub.yaml. ---
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert --file harvest-compose.yml --out kub.yaml --volumes hostPath
kompose.version: 1.28.0 (HEAD)
creationTimestamp: null
labels:
io.kompose.service: u2
name: u2
spec:
ports:
- name: "12990"
port: 12990
targetPort: 12990
selector:
io.kompose.service: u2
status:
loadBalancer: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert --file harvest-compose.yml --out kub.yaml --volumes hostPath
kompose.version: 1.28.0 (HEAD)
creationTimestamp: null
labels:
io.kompose.service: u2
name: u2
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: u2
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert --file harvest-compose.yml --out kub.yaml --volumes hostPath
kompose.version: 1.28.0 (HEAD)
creationTimestamp: null
labels:
io.kompose.network/harvest-default: "true"
io.kompose.service: u2
spec:
containers:
- args:
- --poller
- u2
- --promPort
- "12990"
- --config
- /opt/harvest.yml
image: ghcr.io/netapp/harvest:latest
name: poller-u2
ports:
- containerPort: 12990
resources: {}
volumeMounts:
- mountPath: /opt/harvest/conf
name: u2-hostpath0
- mountPath: /opt/harvest/cert
name: u2-hostpath1
- mountPath: /opt/harvest.yml
name: u2-hostpath2
restartPolicy: Always
volumes:
- hostPath:
path: /Users/rahulg2/GolandProjects/harvest/conf
name: u2-hostpath0
- hostPath:
path: /Users/rahulg2/GolandProjects/harvest/cert
name: u2-hostpath1
- hostPath:
path: /Users/rahulg2/GolandProjects/harvest/harvest.yml
name: u2-hostpath2
status: {}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
creationTimestamp: null
name: harvest-default
spec:
ingress:
- from:
- podSelector:
matchLabels:
io.kompose.network/harvest-default: "true"
podSelector:
matchLabels:
io.kompose.network/harvest-default: "true" logs below
|
Beta Was this translation helpful? Give feedback.
-
You can provide helm-charts to k8 admin to deploy the same if you cann't ssh to k8. https://github.com/NetApp/harvest/tree/main/container/k8#helm-chart |
Beta Was this translation helpful? Give feedback.
-
Hello @rahulguptajss If you try to apply /opt/harvest/conf/rest/custom.yaml If you have an example of a configmap using helm, can you share it? apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: null
labels:
io.kompose.service: mytestcvo
name: mytestcvo
data:
{{- $files := .Files }}
{{- range $path, $_ := .Files.Glob "conf/**" }}
{{ $path | replace "/" "." }}: |
{{ $files.Get $path | indent 5 }}
{{- end }} |
Beta Was this translation helpful? Give feedback.
-
@wooyoungAhn You don't need the whole conf directory to mount. Only modified files are needed. Below is the example for the same.
version: "3.7"
services:
u2:
image: ghcr.io/netapp/harvest:latest
container_name: poller-u2
restart: unless-stopped
ports:
- 12990:12990
command: '--poller u2 --promPort 12990 --config /opt/harvest.yml'
volumes:
- /Users/rahulg2/GolandProjects/harvest/conf/rest/9.12.0/test.yaml:/opt/harvest/conf/rest/9.12.0/test.yaml
- /Users/rahulg2/GolandProjects/harvest/conf/rest/custom.yaml:/opt/harvest/conf/rest/custom.yaml
- /Users/rahulg2/GolandProjects/harvest/harvest.yml:/opt/harvest.yml
networks:
- backend
networks:
backend:
If you need to mount whole directories then |
Beta Was this translation helpful? Give feedback.
-
@wooyoungAhn We have included these steps in our k8 documentation, which can be found [here].(https://github.com/NetApp/harvest/tree/main/container/k8) |
Beta Was this translation helpful? Give feedback.
I have created a
ConfigMap
example as shown below. This should work for any cloud environment. For apvc
based approach, you'll need a relevantStorageClass
for EKS where your Harvest configuration can be stored.Your
harvest-compose.yaml
file as belowRun
kompose convert --file harvest-compose.yml --out kub.yaml --volumes…