corregido apolo y añadido generador de kubeconfig
This commit is contained in:
@@ -4,7 +4,6 @@ metadata:
|
|||||||
name: apolo-meeting
|
name: apolo-meeting
|
||||||
namespace: apolo
|
namespace: apolo
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
|
||||||
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
||||||
nginx.ingress.kubernetes.io/proxy-body-size: "0"
|
nginx.ingress.kubernetes.io/proxy-body-size: "0"
|
||||||
nginx.ingress.kubernetes.io/whitelist-source-range: "192.168.200.0/24,10.244.0.0/16,192.168.4.0/24"
|
nginx.ingress.kubernetes.io/whitelist-source-range: "192.168.200.0/24,10.244.0.0/16,192.168.4.0/24"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: panel
|
- name: panel
|
||||||
image: docker.io/library/python:3.13.7-slim-bookworm
|
image: harbor.c2et.net/library/python:3.13.7-slim-bookworm
|
||||||
command: ["/bin/sh","-c"]
|
command: ["/bin/sh","-c"]
|
||||||
args:
|
args:
|
||||||
- |
|
- |
|
||||||
|
|||||||
18
dashboard/dashboard-admin.yaml
Normal file
18
dashboard/dashboard-admin.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: dashboard-admin
|
||||||
|
namespace: kubernetes-dashboard
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: dashboard-admin
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: cluster-admin
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: dashboard-admin
|
||||||
|
namespace: kubernetes-dashboard
|
||||||
47
dashboard/gen-dashboard-kubeconfig.sh
Executable file
47
dashboard/gen-dashboard-kubeconfig.sh
Executable file
@@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Generar kubeconfig para Kubernetes Dashboard
|
||||||
|
# Archivo: gen-dashboard-kubeconfig.sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NAMESPACE="kubernetes-dashboard"
|
||||||
|
SA_NAME="dashboard-admin"
|
||||||
|
KUBECONFIG_FILE="dashboard.kubeconfig"
|
||||||
|
|
||||||
|
echo "[*] Obteniendo token del ServiceAccount..."
|
||||||
|
TOKEN=$(kubectl -n $NAMESPACE create token $SA_NAME)
|
||||||
|
|
||||||
|
if [ -z "$TOKEN" ]; then
|
||||||
|
echo "[!] No se pudo obtener el token. Revisa que el SA exista: $SA_NAME en $NAMESPACE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Obteniendo API Server..."
|
||||||
|
APISERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
|
||||||
|
|
||||||
|
if [ -z "$APISERVER" ]; then
|
||||||
|
echo "[!] No se pudo obtener el API server del kubeconfig actual."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Generando kubeconfig en $KUBECONFIG_FILE ..."
|
||||||
|
kubectl config set-cluster kubernetes \
|
||||||
|
--server=$APISERVER \
|
||||||
|
--insecure-skip-tls-verify=true \
|
||||||
|
--kubeconfig=$KUBECONFIG_FILE >/dev/null
|
||||||
|
|
||||||
|
kubectl config set-credentials $SA_NAME \
|
||||||
|
--token=$TOKEN \
|
||||||
|
--kubeconfig=$KUBECONFIG_FILE >/dev/null
|
||||||
|
|
||||||
|
kubectl config set-context $SA_NAME@kubernetes \
|
||||||
|
--cluster=kubernetes \
|
||||||
|
--user=$SA_NAME \
|
||||||
|
--kubeconfig=$KUBECONFIG_FILE >/dev/null
|
||||||
|
|
||||||
|
kubectl config use-context $SA_NAME@kubernetes \
|
||||||
|
--kubeconfig=$KUBECONFIG_FILE >/dev/null
|
||||||
|
|
||||||
|
echo "[✔] Kubeconfig generado: $KUBECONFIG_FILE"
|
||||||
|
echo " Puedes probarlo con:"
|
||||||
|
echo " kubectl --kubeconfig=$KUBECONFIG_FILE get pods -n $NAMESPACE"
|
||||||
Reference in New Issue
Block a user