Skip to content

Commit 9934eb9

Browse files
authored
Merge pull request #248605 from dramasamy/offline
Connect to Nexus Kubernetes Cluster
2 parents 0eba01e + 4b6a740 commit 9934eb9

18 files changed

+177
-16
lines changed

articles/operator-nexus/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
href: howto-kubernetes-service-load-balancer.md
8888
- name: Configure role-based access control
8989
href: howto-kubernetes-cluster-aad-rbac.md
90+
- name: Connect to the cluster
91+
href: howto-kubernetes-cluster-connect.md
9092
- name: Nexus Virtual Machine
9193
expanded: false
9294
items:
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
title: Connect to Azure Operator Nexus Kubernetes cluster
3+
description: Learn how to connect to Azure Operator Nexus Kubernetes cluster for interacting, troubleshooting, and maintenance tasks
4+
author: dramasamy
5+
ms.author: dramasamy
6+
ms.service: azure-operator-nexus
7+
ms.topic: how-to
8+
ms.date: 08/17/2023
9+
ms.custom: template-how-to-pattern
10+
---
11+
12+
# Connect to Azure Operator Nexus Kubernetes cluster
13+
14+
This article provides instructions on how to connect to Azure Operator Nexus Kubernetes cluster and its nodes. It includes details on how to connect to the cluster from both Azure and on-premises environments, and how to do so when the ExpressRoute is in both connected and disconnected modes.
15+
16+
In Azure, connected mode and disconnected mode refer to the state of an ExpressRoute circuit. [ExpressRoute](../expressroute/expressroute-introduction.md) is a service provided by Azure that enables organizations to establish a private, high-throughput connection between their on-premises infrastructure and Azure datacenters.
17+
18+
* Connected Mode: In connected mode, the ExpressRoute circuit is fully operational and provides a private connection between your on-premises infrastructure and Azure services. This mode is ideal for scenarios where you need constant connectivity to Azure.
19+
* Disconnected Mode: In disconnected mode, the ExpressRoute circuit is partially or fully down and is unable to provide connectivity to Azure services. This mode is useful when you want to perform maintenance on the circuit or need to temporarily disconnect from Azure.
20+
21+
> [!IMPORTANT]
22+
> While the ExpressRoute circuit is in disconnected mode, traffic will not be able to flow between your on-premises environment and Azure. Therefore, it is recommended to only use disconnected mode when necessary, and to monitor the circuit closely to ensure it is brought back to connected mode as soon as possible.
23+
24+
## Prerequisites
25+
26+
* An Azure Operator Nexus Kubernetes cluster deployed in a resource group in your Azure subscription.
27+
* SSH private key for the cluster nodes.
28+
* If you're connecting in disconnected mode, you must have a jumpbox VM deployed in the same virtual network as the cluster nodes.
29+
30+
## Connected mode access
31+
32+
When operating in connected mode, it's possible to connect to the cluster's kube-api server using the `az connectedk8s proxy` CLI command. Also it's possible to SSH into the worker nodes for troubleshooting or maintenance tasks from Azure using the ExpressRoute circuit.
33+
34+
### Azure Arc for Kubernetes
35+
36+
[!INCLUDE [quickstart-cluster-connect](./includes/kubernetes-cluster/cluster-connect.md)]
37+
38+
### Azure Arc for servers
39+
40+
The `az ssh arc` command allows users to remotely access a cluster VM that has been connected to Azure Arc. This method is a secure way to SSH into the cluster node directly from the command line, while in connected mode. Once the cluster VM has been registered with Azure Arc, the `az ssh arc` command can be used to manage the machine remotely, making it a quick and efficient method for remote management.
41+
42+
To use `az arc ssh`, users need to manually connect the cluster VMs to Arc by creating a service principal (SP) with the 'Azure Connected Machine Onboarding' role. For more detailed steps on how to connect an Azure Operator Nexus Kubernetes cluster node to Arc, refer to the [how to guide](./howto-monitor-naks-cluster.md#monitor-nexus-kubernetes-cluster--vm-layer).
43+
44+
1. Set the required variables.
45+
46+
```bash
47+
RESOURCE_GROUP="myResourceGroup"
48+
CLUSTER_NAME="myNexusK8sCluster"
49+
SUBSCRIPTION_ID="<Subscription ID>"
50+
USER_NAME="azureuser"
51+
SSH_PRIVATE_KEY_FILE="<vm_ssh_id_rsa>"
52+
```
53+
54+
2. Get the available cluster node names.
55+
56+
```azurecli
57+
az networkcloud kubernetescluster show --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID -o json | jq '.nodes[].name'
58+
```
59+
60+
3. Sample output:
61+
62+
```bash
63+
"mynexusk8scluster-0b32128d-agentpool1-md-7h9t4"
64+
"mynexusk8scluster-0b32128d-agentpool1-md-c6xbs"
65+
"mynexusk8scluster-0b32128d-control-plane-qq5jm"
66+
```
67+
68+
4. Run the following command to SSH into the cluster node.
69+
70+
```azurecli
71+
az ssh arc --subscription $SUBSCRIPTION_ID \
72+
--resource-group $RESOURCE_GROUP \
73+
--name <VM Name> \
74+
--local-user $USER_NAME \
75+
--private-key-file $SSH_PRIVATE_KEY_FILE
76+
```
77+
78+
### Direct access to cluster nodes
79+
80+
Another option for securely connecting to an Azure Operator Nexus Kubernetes cluster node is to set up a direct access to the cluster's CNI network from Azure. Using this approach, you can SSH into the cluster nodes, also execute kubectl commands against the cluster using the `kubeconfig` file. Reach out to your network administrator to set up this direct connection from Azure to the cluster's CNI network.
81+
82+
## Disconnected mode access
83+
84+
When the ExpressRoute is in a disconnected mode, you can't access the cluster's kube-api server using the `az connectedk8s proxy` CLI command. Similarly, the `az ssh` CLI command doesn't work for accessing the worker nodes, which can be crucial for troubleshooting or maintenance tasks.
85+
86+
However, you can still ensure a secure and effective connection to your cluster. To do so, establish direct access to the cluster's CNI (Container Network Interface) from within your on-premises infrastructure. This direct access enables you to SSH into the cluster nodes, and lets you execute `kubectl` commands using the `kubeconfig` file.
87+
88+
Reach out to your network administrator to set up this direct connection to the cluster's CNI network.
89+
90+
## IP address of the cluster nodes
91+
92+
Before you can connect to the cluster nodes, you need to find the IP address of the nodes. The IP address of the nodes can be found using the Azure portal or the Azure CLI.
93+
94+
### Use the Azure CLI
95+
96+
1. Set the RESOURCE_GROUP, CLUSTER_NAME, and SUBSCRIPTION_ID variables to match your environment.
97+
98+
```bash
99+
RESOURCE_GROUP="myResourceGroup"
100+
CLUSTER_NAME="myNexusK8sCluster"
101+
SUBSCRIPTION_ID="<Subscription ID>"
102+
```
103+
104+
2. Execute the following command to get the IP address of the nodes.
105+
106+
```azurecli
107+
az networkcloud kubernetescluster show --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID -o json | jq '.nodes[] | select(any(.networkAttachments[]; .networkAttachmentName == "defaultcni")) | {name: .name, ipv4Address: (.networkAttachments[] | select(.networkAttachmentName == "defaultcni").ipv4Address)}'
108+
```
109+
110+
3. Here's the sample output of the command.
111+
112+
```json
113+
{
114+
"name": "mynexusk8scluster-0b32128d-agentpool1-md-7h9t4",
115+
"ipv4Address": "10.5.54.47"
116+
}
117+
{
118+
"name": "mynexusk8scluster-0b32128d-agentpool1-md-c6xbs",
119+
"ipv4Address": "10.5.54.48"
120+
}
121+
{
122+
"name": "mynexusk8scluster-0b32128d-control-plane-qq5jm",
123+
"ipv4Address": "10.5.54.46"
124+
}
125+
```
126+
127+
### Use the Azure portal
128+
129+
To find the IP address of the VM for SSH, follow these steps:
130+
131+
1. Go to the [Azure portal](https://portal.azure.com) and sign-in with your username and password.
132+
2. Type 'Kubernetes Cluster (Operator Nexus)' in the search box and select the 'Kubernetes Cluster' service from the list of results.
133+
134+
:::image type="content" source="media/nexus-kubernetes/search-kubernetes-service.png" lightbox="media/nexus-kubernetes/search-kubernetes-service.png" alt-text="Screenshot of browsing Nexus Kubernetes service.":::
135+
136+
3. Look for the specific 'Nexus Kubernetes cluster' resource you need to use the search.
137+
138+
:::image type="content" source="media/nexus-kubernetes/search-kubernetes-cluster.png" lightbox="media/nexus-kubernetes/search-kubernetes-cluster.png" alt-text="Screenshot of browsing Nexus Kubernetes cluster.":::
139+
140+
4. Once you've found the right resource by matching its name with the cluster name, Select the resource to go to the 'Kubernetes Cluster' home page.
141+
142+
:::image type="content" source="media/nexus-kubernetes/kubernetes-cluster-home.png" lightbox="media/nexus-kubernetes/kubernetes-cluster-home.png" alt-text="Screenshot of Nexus Kubernetes cluster home page.":::
143+
144+
5. Once you've found the right resource by matching its name with the cluster name, go to the 'Kubernetes Cluster Nodes' section in the left menu.
145+
146+
:::image type="content" source="media/nexus-kubernetes/kubernetes-cluster-nodes.png" lightbox="media/nexus-kubernetes/kubernetes-cluster-nodes.png" alt-text="Screenshot of browsing Nexus Kubernetes cluster nodes.":::
147+
148+
6. Select on the Kubernetes node name you're interested in to see its details.
149+
7. Check the 'Attached Networks' tab to find the IP address of the node's 'Layer 3 Network' that used as CNI network.
150+
151+
:::image type="content" source="media/nexus-kubernetes/control-plane-network-attachment.png" lightbox="media/nexus-kubernetes/control-plane-network-attachment.png" alt-text="Screenshot of browsing Nexus Kubernetes cluster node networks.":::
152+
153+
## Next steps
154+
155+
Try out the following articles to learn more about Azure Operator Nexus Kubernetes cluster.
156+
- [Quickstart: Deploy an Azure Operator Nexus Kubernetes cluster using Bicep](./quickstarts-kubernetes-cluster-deployment-bicep.md)
157+
- [How to: Monitor Azure Operator Nexus Kubernetes cluster](./howto-monitor-naks-cluster.md)

articles/operator-nexus/includes/kubernetes-cluster/cluster-connect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ To access your cluster, you need to set up the cluster connect `kubeconfig`. Aft
1313

1414
1. Set `CLUSTER_NAME`, `RESOURCE_GROUP` and `SUBSCRIPTION_ID` variables.
1515
```bash
16-
CLUSTER_NAME="myNexusAKSCluster"
16+
CLUSTER_NAME="myNexusK8sCluster"
1717
RESOURCE_GROUP="myResourceGroup"
1818
SUBSCRIPTION_ID=<set the correct subscription_id>
1919
```

articles/operator-nexus/includes/kubernetes-cluster/quickstart-add-node-pool-params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"contentVersion": "1.0.0.0",
44
"parameters": {
55
"kubernetesClusterName":{
6-
"value": "myNexusAKSCluster"
6+
"value": "myNexusK8sCluster"
77
},
88
"extendedLocation": {
99
"value": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/microsoft.extendedlocation/customlocations/<custom-location-name>"

articles/operator-nexus/includes/kubernetes-cluster/quickstart-cluster-connect.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ ms.service: azure-operator-nexus
88

99
Now that the Nexus Kubernetes cluster has been successfully created and connected to Azure Arc, you can easily connect to it using the cluster connect feature. Cluster connect allows you to securely access and manage your cluster from anywhere, making it convenient for interactive development, debugging, and cluster administration tasks.
1010

11+
For more detailed information about available options, see [Connect to an Azure Operator Nexus Kubernetes cluster](../../howto-kubernetes-cluster-connect.md).
12+
1113
[!INCLUDE [cluster-connect](./cluster-connect.md)]

articles/operator-nexus/includes/kubernetes-cluster/quickstart-deploy-params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"contentVersion": "1.0.0.0",
44
"parameters": {
55
"kubernetesClusterName":{
6-
"value": "myNexusAKSCluster"
6+
"value": "myNexusK8sCluster"
77
},
88
"adminGroupObjectIds": {
99
"value": [

articles/operator-nexus/includes/kubernetes-cluster/quickstart-review-deployment-cli.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ ms.service: azure-operator-nexus
88

99
After the deployment finishes, you can view the resources using the CLI or the Azure portal.
1010

11-
To view the details of the ```myNexusAKSCluster``` cluster in the ```myResourceGroup``` resource group, execute the following Azure CLI command:
11+
To view the details of the ```myNexusK8sCluster``` cluster in the ```myResourceGroup``` resource group, execute the following Azure CLI command:
1212

1313
```azurecli
1414
az networkcloud kubernetescluster show \
15-
--name myNexusAKSCluster \
15+
--name myNexusK8sCluster \
1616
--resource-group myResourceGroup
1717
```
1818

19-
Additionally, to get a list of agent pool names associated with the ```myNexusAKSCluster``` cluster in the ```myResourceGroup``` resource group, you can use the following Azure CLI command.
19+
Additionally, to get a list of agent pool names associated with the ```myNexusK8sCluster``` cluster in the ```myResourceGroup``` resource group, you can use the following Azure CLI command.
2020

2121
```azurecli
2222
az networkcloud kubernetescluster agentpool list \
23-
--kubernetes-cluster-name myNexusAKSCluster \
23+
--kubernetes-cluster-name myNexusK8sCluster \
2424
--resource-group myResourceGroup \
2525
--output table
2626
```

articles/operator-nexus/includes/kubernetes-cluster/quickstart-review-nodepool.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ ms.service: azure-operator-nexus
1212
The following output example resembles successful creation of the agent pool.
1313

1414
```bash
15-
$ az networkcloud kubernetescluster agentpool list --kubernetes-cluster-name myNexusAKSCluster --resource-group myResourceGroup --output table
15+
$ az networkcloud kubernetescluster agentpool list --kubernetes-cluster-name myNexusK8sCluster --resource-group myResourceGroup --output table
1616
This command is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
1717
Count Location Mode Name ProvisioningState ResourceGroup VmSkuName
1818
------- ---------- ------ ---------------------------- ------------------- --------------- -----------
19-
1 eastus System myNexusAKSCluster-nodepool-1 Succeeded myResourceGroup NC_P10_56_v1
20-
1 eastus User myNexusAKSCluster-nodepool-2 Succeeded myResourceGroup NC_P10_56_v1
19+
1 eastus System myNexusK8sCluster-nodepool-1 Succeeded myResourceGroup NC_P10_56_v1
20+
1 eastus User myNexusK8sCluster-nodepool-2 Succeeded myResourceGroup NC_P10_56_v1
2121
```
39.3 KB
Loading
47.2 KB
Loading

0 commit comments

Comments
 (0)