Created
September 26, 2022 06:39
-
-
Save yuswitayudi/98eaeb2b9a6077868bc96159a2d998f6 to your computer and use it in GitHub Desktop.
Revisions
-
yuswitayudi revised this gist
Sep 26, 2022 . No changes.There are no files selected for viewing
-
yuswitayudi created this gist
Sep 26, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ for i in yuswitayudi do openssl genrsa -out $i.key 2048 openssl req -new -key $i.key -out $i.csr -subj "/CN=$i/O=finance" openssl x509 -req -in $i.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out $i.crt -days 365 kubectl --kubeconfig $i.config config set-cluster kubernetes-dev --server https://192.168.1.223:6443 --certificate-authority=ca.crt kubectl --kubeconfig $i.config config set-credentials $i --client-certificate $i.crt --client-key $i.key kubectl --kubeconfig $i.config config set-context $i-dev --cluster kubernetes-dev --namespace dev --user=$i kubectl --kubeconfig $i.config config use-context $i-dev kubectl create role $i-dev --verb=* --resource=*.* --namespace dev kubectl create rolebinding $i-dev-rolebinding --role=$i-dev --user $i --namespace=dev done