ingress creation error: # jsonnet monitor-ingress.jsonnet | kubectl apply -f - error: error validating "STDIN": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false #2160
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
jsonnet monitor-ingress.jsonnet | kubectl apply -f -
error: error validating "STDIN": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false
the jsonnet file should be the same as the example one. k8s 1.23.17
local ingress(name, namespace, rules) = {
apiVersion: 'networking.k8s.io/v1',
kind: 'Ingress',
metadata: {
name: name,
namespace: namespace,
annotations: {
'nginx.ingress.kubernetes.io/auth-type': 'basic',
'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth',
'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required',
},
},
spec: { rules: rules },
};
local kp =
(import 'kube-prometheus/main.libsonnet') +
{
values+:: {
common+: {
namespace: 'prometheus-stack',
},
grafana+:: {
config+: {
sections+: {
server+: {
root_url: 'http://lab7-grafana.example.com/',
},
},
},
},
},
// Configure External URL's per application
alertmanager+:: {
alertmanager+: {
spec+: {
externalUrl: 'http://lab7-alertmanager.example.com',
},
},
},
prometheus+:: {
prometheus+: {
spec+: {
externalUrl: 'http://lab7-prometheus.example.com',
},
},
},
// Create ingress objects per application
ingress+:: {
'alertmanager-main': ingress(
'alertmanager-main',
$.values.common.namespace,
[{
host: 'lab7-alertmanager.example.com',
http: {
paths: [{
path: '/',
pathType: 'Prefix',
backend: {
service: {
name: 'alertmanager-main',
port: {
name: 'web',
},
},
},
}],
},
}]
),
grafana: ingress(
'grafana',
$.values.common.namespace,
[{
host: 'lab7-grafana.example.com',
http: {
paths: [{
path: '/',
pathType: 'Prefix',
backend: {
service: {
name: 'grafana',
port: {
name: 'http',
},
},
},
}],
},
}],
),
'prometheus-k8s': ingress(
'prometheus-k8s',
$.values.common.namespace,
[{
host: 'lab7-prometheus.example.com',
http: {
paths: [{
path: '/',
pathType: 'Prefix',
backend: {
service: {
name: 'prometheus-k8s',
port: {
name: 'web',
},
},
},
}],
},
}],
),
},
} + {
// Create basic auth secret - replace 'auth' file with your own
ingress+:: {
'basic-auth-secret': {
apiVersion: 'v1',
kind: 'Secret',
metadata: {
name: 'basic-auth',
namespace: $.values.common.namespace,
},
data: { auth: std.base64(importstr 'auth') },
type: 'Opaque',
},
},
};
{ [name + '-ingress']: kp.ingress[name] for name in std.objectFields(kp.ingress) }
Beta Was this translation helpful? Give feedback.
All reactions