Compare commits

...

4 commits

Author SHA1 Message Date
2e3bcfac2d Update haproxy-ingress-rbac.yaml
Some checks failed
Build Go Binary / build (push) Has been cancelled
2025-06-29 17:30:27 +02:00
fd31ce7eed Add generate_kubeconfig.sh
Some checks failed
Build Go Binary / build (push) Has been cancelled
2025-06-29 15:21:42 +02:00
f22d7423e8 Add haproxy-ingress-rbac.yaml
Some checks failed
Build Go Binary / build (push) Has been cancelled
2025-06-29 15:17:26 +02:00
3bcf42e94a Add haproxy-ingress-configmap.yaml
Some checks failed
Build Go Binary / build (push) Has been cancelled
2025-06-29 15:17:10 +02:00
3 changed files with 66 additions and 0 deletions

30
generate_kubeconfig.sh Normal file
View file

@ -0,0 +1,30 @@
#!/bin/bash
# Erstellt ein Token
TOKEN=$(kubectl -n kube-system create token haproxy-sa)
# Get Cluster Info
CLUSTER_NAME=$(kubectl config view -o jsonpath='{.clusters[0].name}')
CLUSTER_SERVER=$(kubectl config view -o jsonpath="{.clusters[0].cluster.server}")
CA_DATA=$(kubectl config view --raw -o jsonpath="{.clusters[0].cluster.certificate-authority-data}")
# Erstelle kubeconfig
cat <<EOF > haproxy-kubeconfig.yaml
apiVersion: v1
kind: Config
clusters:
- cluster:
certificate-authority-data: ${CA_DATA}
server: ${CLUSTER_SERVER}
name: ${CLUSTER_NAME}
contexts:
- context:
cluster: ${CLUSTER_NAME}
user: haproxy-sa
name: haproxy-context
current-context: haproxy-context
users:
- name: haproxy-sa
user:
token: ${TOKEN}
EOF

View file

@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: haproxy-config
namespace: kube-system
data:
ssl-redirect: "true"
timeout-http-request: "5s"
use-forwarded-headers: "true"

27
haproxy-ingress-rbac.yaml Normal file
View file

@ -0,0 +1,27 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: gateway
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: gateway
rules:
- apiGroups: [""]
resources: ["endpoints", "services", "namespaces", "nodes"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: gateway
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: gateway
subjects:
- kind: ServiceAccount
name: gateway
namespace: kube-system