Skip to content

Instantly share code, notes, and snippets.

@slashk
Created March 2, 2017 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slashk/7ee7827b535d2cd14b3a61a1b1944850 to your computer and use it in GitHub Desktop.
Save slashk/7ee7827b535d2cd14b3a61a1b1944850 to your computer and use it in GitHub Desktop.
k8s cluster token generator for kubeadm
package main
import (
"fmt"
"math/rand"
)
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
func RandStringBytes(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = letterBytes[rand.Intn(len(letterBytes))]
}
return string(b)
}
func main() {
fmt.Printf("%s.%s", RandStringBytes(6), RandStringBytes(16))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment