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 characters
| cat <<EOF | kubectl apply -f - | |
| apiVersion: certificates.k8s.io/v1beta1 | |
| kind: CertificateSigningRequest | |
| metadata: | |
| name: tempcsr | |
| spec: | |
| request: $(cat server.csr | base64 | tr -d '\n') | |
| groups: | |
| - system:authenticated | |
| EOF |
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 characters
| config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) | |
| clientset, err := kubernetes.NewForConfig(config) | |
| check("The following error occured while loading the Kube Config file", err) | |
| csr := &certificates.CertificateSigningRequest{ | |
| ObjectMeta: v1.ObjectMeta{ | |
| Name: "tempcsr", | |
| }, | |
| Spec: certificates.CertificateSigningRequestSpec{ | |
| Groups: []string{ | |
| "system:authenticated", |
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 characters
| func findKubeConfig() (string, error) { | |
| env := os.Getenv("KUBECONFIG") | |
| if env != "" { | |
| return env, nil | |
| } | |
| path, err := homedir.Expand("~/.kube/config") | |
| if err != nil { | |
| return "", err | |
| } | |
| return path, nil |
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 characters
| key, err := rsa.GenerateKey(rand.Reader, 1024) | |
| check("The following error occured while creating the RSA key", err) | |
| keyDer := x509.MarshalPKCS1PrivateKey(key) | |
| commonName := *usernamePtr | |
| emailAddress := *emailPtr | |
| org := strings.ToUpper(*orgazniationPtr) | |
| orgUnit := strings.ToUpper(*orgUnitPtr) | |
| city := strings.ToUpper(*cityPtr) | |
| state := strings.ToUpper(*provincePtr) | |
| country := strings.ToUpper(*countryPtr) |
NewerOlder