For Kubernetes deployment add this snippet of code:

kind: Deployment
spec:
  template:
    metadata:
      annotations:
        prometheus.io/port: "9090"
        prometheus.io/path: "/metrics"
        prometheus.io/scrape: "true"