Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Remove the apiserver-boot dependency for generate certificate. #591

Closed
medinatiger opened this issue Feb 9, 2018 · 2 comments
Closed

Remove the apiserver-boot dependency for generate certificate. #591

medinatiger opened this issue Feb 9, 2018 · 2 comments

Comments

@medinatiger
Copy link
Contributor

We should remove the need to run apiserver-boot to generate certificate for running ext api server. The logs of apiserver-boot shows the required openssl commands to do the job.

@medinatiger
Copy link
Contributor Author

Thanks the idea from @mrIncompetent
//import "k8s.io/client-go/util/cert/triple"
caKeyPair, err := triple.NewCA("root-ca.example.com")
if err != nil {
return fmt.Errorf("failed to create root-ca: %v", err)
}

apiserverKeypair, err := triple.NewServerKeyPair(caKeyPair, "apiserver.example.com", "kubernetes", "default", "cluster.local", []string{"10.10.10.1"}, []string{"some-other-hostname"})
if err != nil {
return fmt.Errorf("failed to create apiserver key pair: %v", err)
}

//to get it pem encoded as byte slice:
// import "k8s.io/client-go/util/cert"
b1 := cert.EncodePrivateKeyPEM(apiserverKeypair.Key)
b2 := cert.EncodeCertPEM(apiserverKeypair.Cert)

@rsdcastro
Copy link

This issue was moved to kubernetes-sigs/cluster-api#36

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants