#!/bin/bash # 每个对应一个namespace,用户名和namespace名称相同 # 注意修改KUBE_APISERVER为你的API Server的地址 KUBE_APISERVER=$1 USER=$2 USAGE="USAGE: create-user.sh \n Example: https://172.22.1.1:6443 brand" CSR=`pwd`/user-csr.json SSL_PATH="/etc/kubernetes/ssl" SSL_FILES=(ca-key.pem ca.pem ca-config.json) CERT_FILES=(${USER}.csr $USER-key.pem ${USER}.pem) if [[ $KUBE_APISERVER == "" ]]; then echo -e $USAGE exit 1 fi if [[ $USER == "" ]];then echo -e $USAGE exit 1 fi # 创建用户的csr文件 function createCSR(){ cat>$CSR<