Skip to content

Commit 10a4c39

Browse files
committed
Added sample commands
1 parent f8ef43b commit 10a4c39

File tree

1 file changed

+64
-8
lines changed

1 file changed

+64
-8
lines changed

articles/operator-nexus/howto-kubernetes-cluster-manage-ssh-key.md

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This article describes how to configure the SSH key on your Nexus Kubernetes age
1818
Before proceeding with this how-to guide, it's recommended that you:
1919

2020
* Refer to the Operator Nexus Kubernetes cluster [QuickStart guide](./quickstarts-kubernetes-cluster-deployment-bicep.md) for a comprehensive overview and steps involved.
21-
* Ensure that you meet the outlined prerequisites to ensure smooth implementation of the guide.
21+
* Ensure that you meet the outlined prerequisites in the quickstart to ensure smooth implementation of the guide.
2222

2323
## Configure Operator Nexus Kubernetes cluster node SSH keys
2424

@@ -27,15 +27,71 @@ When you're setting up an Operator Nexus Kubernetes cluster, you need to provide
2727
There are a few different ways that you can provide SSH keys for your cluster nodes.
2828

2929
* If you want to use the same SSH key for all nodes in your cluster, you can provide an array of public keys when you create the cluster. These keys are inserted into all agent pool nodes and control plane nodes.
30-
* If you want to use different SSH keys for different agent pools or control plane nodes, you can provide a unique public key for each pool, allows you to manage SSH access more granularly. Any new agent pool gets added to the cluster later will inherit the cluster wide keys.
31-
* Here are the Bicep and ARM template properties to provide SSH keys for your cluster nodes:
32-
* `properties.administratorConfiguration.sshPublicKeys` - For the cluster wide keys.
33-
* `initialAgentPoolConfigurations[].administratorConfiguration.sshPublicKeys` - For each agent pool, you can provide public keys that are inserted into the nodes in that pool.
34-
* `controlPlaneNodeConfiguration.administratorConfiguration.sshPublicKeys` - For the control plane, you can provide public keys that are inserted into the control plane nodes.
30+
* If you want to use different SSH keys for different agent pools or control plane nodes, you can provide a unique public key for each pool, allows you to manage SSH access more granularly, this overrides the cluster wide keys. Any new agent pool gets added to the cluster later without keys use the cluster wide keys, if it has key then it uses the provided key.
3531
* If you don't provide any SSH keys when creating your cluster, no SSH keys are inserted into the nodes. This means that users can't SSH into the nodes. You can add SSH keys later by updating the cluster configuration, but can't remove those keys once it's added.
3632

37-
Refer the [Disconnected mode access](./howto-kubernetes-cluster-connect.md#disconnected-mode-access) guide for insight into when you might need SSH keys and how to locate the node IP address.
38-
33+
Refer the [Disconnected mode access](./howto-kubernetes-cluster-connect.md#disconnected-mode-access) guide for steps to find the cluster node IP address.
34+
35+
### [Azure CLI](#tab/azure-cli)
36+
37+
Following are the variables you need to set, along with the [quickstart guide](./quickstarts-kubernetes-cluster-deployment-cli.md#create-an-azure-nexus-kubernetes-cluster) default values you can use for certain variables.
38+
39+
`SSH_PUBLIC_KEY` - For the cluster wide keys.
40+
`CONTROL_PLANE_SSH_PUBLIC_KEY` - For the control plane, you can provide public keys that are inserted into the control plane nodes.
41+
`INITIAL_AGENT_POOL_SSH_PUBLIC_KEY` - For each agent pool, you can provide public keys that are inserted into the nodes in that pool.
42+
43+
```azurecli
44+
az networkcloud kubernetescluster create \
45+
--name "${CLUSTER_NAME}" \
46+
--resource-group "${RESOURCE_GROUP}" \
47+
--subscription "${SUBSCRIPTION_ID}" \
48+
--extended-location name="${CUSTOM_LOCATION}" type=CustomLocation \
49+
--location "${LOCATION}" \
50+
--kubernetes-version "${K8S_VERSION}" \
51+
--aad-configuration admin-group-object-ids="[${AAD_ADMIN_GROUP_OBJECT_ID}]" \
52+
--admin-username "${ADMIN_USERNAME}" \
53+
--ssh-key-values "${SSH_PUBLIC_KEY}" \
54+
--control-plane-node-configuration \
55+
count="${CONTROL_PLANE_COUNT}" \
56+
vm-sku-name="${CONTROL_PLANE_VM_SIZE}" \
57+
ssh-key-values='["${CONTROL_PLANE_SSH_PUBLIC_KEY}"]' \
58+
--initial-agent-pool-configurations "[{count:${INITIAL_AGENT_POOL_COUNT},mode:System,name:${INITIAL_AGENT_POOL_NAME},vm-sku-name:${INITIAL_AGENT_POOL_VM_SIZE},ssh-key-values:['${INITIAL_AGENT_POOL_SSH_PUBLIC_KEY}']}]"\
59+
--network-configuration \
60+
cloud-services-network-id="${CSN_ARM_ID}" \
61+
cni-network-id="${CNI_ARM_ID}" \
62+
pod-cidrs="[${POD_CIDR}]" \
63+
service-cidrs="[${SERVICE_CIDR}]" \
64+
dns-service-ip="${DNS_SERVICE_IP}"
65+
```
66+
67+
### [Azure ARM/Bicep](#tab/other)
68+
69+
The `administratorConfiguration` can be inserted into the `properties` object for the cluster wide keys, and into the `initialAgentPoolConfigurations[].administratorConfiguration` object for each agent pool. The `controlPlaneNodeConfiguration.administratorConfiguration` object is used for the control plane. Update the quickstart ARM template and Bicep templates with the required keys, and in required object.
70+
71+
```arm
72+
"administratorConfiguration": {
73+
"adminUsername": "[parameters('adminUsername')]",
74+
"sshPublicKeys": [
75+
{
76+
"keyData": "[parameters('sshPublicKey')]"
77+
}
78+
]
79+
}
80+
```
81+
82+
```bicep
83+
administratorConfiguration: {
84+
adminUsername: adminUsername
85+
sshPublicKeys: [
86+
{
87+
keyData: sshPublicKey
88+
}
89+
]
90+
}
91+
```
92+
93+
---
94+
3995
## Manage Operator Nexus Kubernetes cluster node SSH keys
4096

4197
You can manage the SSH keys for the nodes in your Operator Nexus Kubernetes cluster after the cluster has been created. Updating the SSH keys is possible, but removing all SSH keys from the cluster node isn't an option. Instead, any new keys provided will replace all existing keys.

0 commit comments

Comments
 (0)