diff --git a/cmd/kops/create_cluster.go b/cmd/kops/create_cluster.go index 369f553b3d..61f9f12ad1 100644 --- a/cmd/kops/create_cluster.go +++ b/cmd/kops/create_cluster.go @@ -33,6 +33,7 @@ import ( "github.com/spf13/pflag" "go.uber.org/multierr" apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/klog/v2" @@ -700,6 +701,20 @@ func RunCreateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Cr obj = append(obj, group) } + for name, key := range c.SSHPublicKeys { + obj = append(obj, &api.SSHCredential{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Labels: map[string]string{ + api.LabelClusterName: cluster.Name, + }, + }, + Spec: api.SSHCredentialSpec{ + PublicKey: strings.TrimSpace(string(key)), + }, + }) + } + for _, o := range addons { obj = append(obj, o.ToUnstructured()) }