Skip to content

Commit ed7443c

Browse files
author
Michael Weibel
committed
mark sshPublicKey as optional, docs windows ssh
windows instances do not have the capability to set a sshPublicKey. It must be done via cloudbase-init. This change documents this fact and marks the `sshPublicKey` as optional since it's not required and an empty string (default for string type) is sufficient.
1 parent 63db332 commit ed7443c

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

api/v1beta1/azuremachine_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ type AzureMachineSpec struct {
8181
// +optional
8282
DataDisks []DataDisk `json:"dataDisks,omitempty"`
8383

84+
// SSHPublicKey is the SSH public key string, base64-encoded to add to a Virtual Machine. Linux only.
85+
// Refer to documentation on how to set up SSH access on Windows instances.
86+
// +optional
8487
SSHPublicKey string `json:"sshPublicKey"`
8588

8689
// AdditionalTags is an optional set of tags to add to an instance, in addition to the ones added by default by the

config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,8 +1888,9 @@ spec:
18881888
x-kubernetes-int-or-string: true
18891889
type: object
18901890
sshPublicKey:
1891-
description: SSHPublicKey is the SSH public key string base64
1892-
encoded to add to a Virtual Machine
1891+
description: SSHPublicKey is the SSH public key string, base64-encoded
1892+
to add to a Virtual Machine. Linux only. Refer to documentation
1893+
on how to set up SSH access on Windows instances.
18931894
type: string
18941895
subnetName:
18951896
description: 'Deprecated: SubnetName should be set in the networkInterfaces
@@ -1942,7 +1943,6 @@ spec:
19421943
type: string
19431944
required:
19441945
- osDisk
1945-
- sshPublicKey
19461946
- vmSize
19471947
type: object
19481948
userAssignedIdentities:

config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachines.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,9 @@ spec:
14921492
x-kubernetes-int-or-string: true
14931493
type: object
14941494
sshPublicKey:
1495+
description: SSHPublicKey is the SSH public key string, base64-encoded
1496+
to add to a Virtual Machine. Linux only. Refer to documentation
1497+
on how to set up SSH access on Windows instances.
14951498
type: string
14961499
subnetName:
14971500
description: 'Deprecated: SubnetName should be set in the networkInterfaces
@@ -1573,7 +1576,6 @@ spec:
15731576
type: string
15741577
required:
15751578
- osDisk
1576-
- sshPublicKey
15771579
- vmSize
15781580
type: object
15791581
status:

config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinetemplates.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,9 @@ spec:
12761276
x-kubernetes-int-or-string: true
12771277
type: object
12781278
sshPublicKey:
1279+
description: SSHPublicKey is the SSH public key string, base64-encoded
1280+
to add to a Virtual Machine. Linux only. Refer to documentation
1281+
on how to set up SSH access on Windows instances.
12791282
type: string
12801283
subnetName:
12811284
description: 'Deprecated: SubnetName should be set in the
@@ -1363,7 +1366,6 @@ spec:
13631366
type: string
13641367
required:
13651368
- osDisk
1366-
- sshPublicKey
13671369
- vmSize
13681370
type: object
13691371
required:

docs/book/src/topics/windows.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,36 @@ When creating a cluster with `Machinepool` if the Machine Pool name is longer th
101101

102102
### VM password and access
103103
The VM password is [random generated](https://cloudbase-init.readthedocs.io/en/latest/plugins.html#setting-password-main)
104-
by Cloudbase-init during provisioning of the VM. For Access to the VM you can use ssh which will be configured with SSH
105-
public key you provided during deployment.
104+
by Cloudbase-init during provisioning of the VM. For Access to the VM you can use ssh, which can be configured with a
105+
public key you provide during deployment.
106+
It's required to specify the SSH key using the `users` property in the Kubeadm config template. Specifying the `sshPublicKey` on `AzureMachine` / `AzureMachinePool` resources only works with Linux instances.
107+
108+
For example like this:
109+
```yaml
110+
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3
111+
kind: KubeadmConfigTemplate
112+
metadata:
113+
name: test1-md-0
114+
namespace: default
115+
spec:
116+
template:
117+
spec:
118+
...
119+
users:
120+
- name: username
121+
groups: Administrators
122+
sshAuthorizedKeys:
123+
- "ssh-rsa AAAA..."
124+
```
106125
107126
To SSH:
108127
109128
```
110129
ssh -t -i .sshkey -o 'ProxyCommand ssh -i .sshkey -W %h:%p capi@<api-server-ip>' capi@<windows-ip>
111130
```
112131

132+
Refer to [SSH Access for nodes](ssh-access.md) for more instructions on how to connect using SSH.
133+
113134
> There is also a [CAPZ kubectl plugin](https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/hack/debugging/Readme.md) that automates the ssh connection using the Management cluster
114135
115136
To RDP you can proxy through the api server:

exp/api/v1beta1/azuremachinepool_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ type (
6262
// +optional
6363
DataDisks []infrav1.DataDisk `json:"dataDisks,omitempty"`
6464

65-
// SSHPublicKey is the SSH public key string base64 encoded to add to a Virtual Machine
65+
// SSHPublicKey is the SSH public key string, base64-encoded to add to a Virtual Machine. Linux only.
66+
// Refer to documentation on how to set up SSH access on Windows instances.
67+
// +optional
6668
SSHPublicKey string `json:"sshPublicKey"`
6769

6870
// Deprecated: AcceleratedNetworking should be set in the networkInterfaces field.

0 commit comments

Comments
 (0)