Kubernetes manifests for Kubernetes cluster configurations
|
All checks were successful
ci/woodpecker/push/linting Pipeline was successful
|
||
|---|---|---|
| .woodpecker | ||
| manifests | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| .markdownlint-cli2.jsonc | ||
| .yamllint | ||
| readme.md | ||
| renovate.json | ||
cluster-configs
These manifests configure the generic cluster configurations done afterwards. Like creating users.
Usermanagement
To create a kubeconfig file for a user created by this manifest, execute the following.
# Username
KUBE_USERNAME=foo-bar
# Get the token
TOKEN=$(kubectl create token ${KUBE_USERNAME} -n kube-system --duration=87600h)
# Get cluster info
CLUSTER_NAME=$(kubectl config view --minify -o jsonpath='{.clusters[0].name}')
CLUSTER_SERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
CLUSTER_CA=$(kubectl config view --minify --raw -o jsonpath='{.clusters[0].cluster.certificate-authority-data}')
# Create kubeconfig
cat > ${KUBE_USERNAME}-kubeconfig.yaml <<EOF
apiVersion: v1
kind: Config
clusters:
- cluster:
certificate-authority-data: ${CLUSTER_CA}
server: ${CLUSTER_SERVER}
name: ${CLUSTER_NAME}
contexts:
- context:
cluster: ${CLUSTER_NAME}
user: ${KUBE_USERNAME}
name: ${KUBE_USERNAME}@${CLUSTER_NAME}
current-context: ${KUBE_USERNAME}@${CLUSTER_NAME}
users:
- name: ${KUBE_USERNAME}
user:
token: ${TOKEN}
EOF