mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-09 19:58:07 +03:00
Add RBAC to binding Dahsboard UI
This commit is contained in:
@@ -91,6 +91,34 @@ subjects:
|
||||
name: kubernetes-dashboard
|
||||
namespace: {{ system_namespace }}
|
||||
|
||||
---
|
||||
# ------------------- Gross Hack For anonymous auth through api proxy ------------------- #
|
||||
# Allows users to reach login page and other proxied dashboard URLs
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: kubernetes-dashboard-anonymous
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["services/proxy"]
|
||||
resourceNames: ["https:kubernetes-dashboard:"]
|
||||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
||||
- nonResourceURLs: ["/ui", "/ui/*", "/api/v1/namespaces/{{ system_namespace }}/services/https:kubernetes-dashboard:/proxy/*"]
|
||||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
||||
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: kubernetes-dashboard-anonymous
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: kubernetes-dashboard-anonymous
|
||||
subjects:
|
||||
- kind: User
|
||||
name: system:anonymous
|
||||
|
||||
---
|
||||
# ------------------- Dashboard Deployment ------------------- #
|
||||
|
||||
@@ -112,6 +140,14 @@ spec:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
spec:
|
||||
{% if not dashboard_use_custom_certs %}
|
||||
initContainers:
|
||||
- name: kubernetes-dashboard-init
|
||||
image: {{ dashboard_init_image_repo }}:{{ dashboard_init_image_tag }}
|
||||
volumeMounts:
|
||||
- name: kubernetes-dashboard-certs
|
||||
mountPath: /certs
|
||||
{% endif %}
|
||||
containers:
|
||||
- name: kubernetes-dashboard
|
||||
image: {{ dashboard_image_repo }}:{{ dashboard_image_tag }}
|
||||
@@ -127,7 +163,14 @@ spec:
|
||||
- containerPort: 8443
|
||||
protocol: TCP
|
||||
args:
|
||||
{% if not dashboard_use_custom_certs %}
|
||||
- --tls-key-file=/certs/{{ dashboard_tls_key_file }}
|
||||
- --tls-cert-file=/certs/{{ dashboard_tls_cert_file }}
|
||||
- --authentication-mode=token{% if kube_basic_auth|default(false) %},basic{% endif %}
|
||||
{% else %}
|
||||
- --auto-generate-certificates
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
# Uncomment the following line to manually specify Kubernetes API server Host
|
||||
# If not specified, Dashboard will attempt to auto discover the API server and connect
|
||||
# to it. Uncomment only if the default does not work.
|
||||
|
||||
Reference in New Issue
Block a user