Question: I'm trying to deploy a `Servicemonitor` ...
# general
d
Question: I'm trying to deploy a
Servicemonitor
to my EKS cluster into a specific namespace, but however I tried, it still installs into default namespace. Any idea on how to deploy not in default namespace? Here is the code I have:
Copy code
export const postgresServiceMonitorCRD = new k8s.apiextensions.CustomResource("postgres-servicemonitor", {
    apiVersion: "<http://monitoring.coreos.com/v1|monitoring.coreos.com/v1>",
    kind: "ServiceMonitor",
    namespace: namespaceName,
    transformations: [addMonitoringNamespace],
    metadata: {
        labels: {
            app: "prometheus-postgres-exporter-servicemonitor",
            release: "prometheus-operator",
        },
        name: "postgres-servicemonitor",
    },
    spec: {
        namespaceSelector: {
            any: true,
        },
        endpoints: [{
            port: "http",
            interval: "30s",
        },],
        selector: {
            matchLabels: {
                app: "prometheus-postgres-exporter",
                release: "postgres-exporter",
            },
        },
    },
});
m
Try setting
metadata.namespace
.
d
that worked!
thanks!
👍 1