-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8s-dashboard.tf
87 lines (74 loc) · 1.9 KB
/
k8s-dashboard.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
resource "kubernetes_namespace" "kube-dashboard" {
metadata {
name = "kube-dashboard"
annotations = {}
labels = {}
}
}
resource "helm_release" "kube-dashboard" {
name = "kube-dashboard"
repository = "https://kubernetes.github.io/dashboard/"
chart = "kubernetes-dashboard"
version = "7.5.0"
namespace = kubernetes_namespace.kube-dashboard.metadata[0].name
set {
name = "nginx.enabled"
value = "false"
}
set {
name = "metrics-server.enabled"
value = "false"
}
set {
name = "app.ingress.enabled"
value = true
}
set {
name = "app.ingress.ingressClassName"
value = "nginx"
}
set {
name = "app.ingress.hosts[0]"
value = "kube.travigo.app"
}
set {
name = "app.ingress.tls.enabled"
value = false
}
set {
name = "kong.admin.addresses[0]"
value = "127.0.0.1"
}
}
resource "kubernetes_service_account" "dahsboard_admin_user" {
metadata {
name = "admin-user"
namespace = kubernetes_namespace.kube-dashboard.metadata[0].name
}
}
resource "kubernetes_secret" "dashboard_admin_user" {
metadata {
annotations = {
"kubernetes.io/service-account.name" = kubernetes_service_account.dahsboard_admin_user.metadata[0].name
}
name = "dashboard-admin-user"
namespace = kubernetes_namespace.kube-dashboard.metadata[0].name
}
type = "kubernetes.io/service-account-token"
wait_for_service_account_token = true
}
resource "kubernetes_cluster_role_binding" "dashboard_admin_user" {
metadata {
name = "admin-user"
}
role_ref {
api_group = "rbac.authorization.k8s.io"
kind = "ClusterRole"
name = "cluster-admin"
}
subject {
kind = "ServiceAccount"
name = kubernetes_service_account.dahsboard_admin_user.metadata[0].name
namespace = kubernetes_namespace.kube-dashboard.metadata[0].name
}
}