Skip to content

Commit d7d6b8a

Browse files
authored
Merge pull request #270733 from dramasamy/connect
[NotReleaseSpecific] Remove connected and disconnected mode statements from cluster connect doc
2 parents 1a2c0d5 + 2c5a699 commit d7d6b8a

File tree

3 files changed

+75
-72
lines changed

3 files changed

+75
-72
lines changed

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

Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
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
3+
description: Learn how to connect to Azure Operator Nexus Kubernetes cluster for interacting, troubleshooting, and maintenance tasks.
44
author: dramasamy
55
ms.author: dramasamy
66
ms.service: azure-operator-nexus
@@ -11,109 +11,112 @@ ms.custom: template-how-to-pattern, devx-track-azurecli
1111

1212
# Connect to Azure Operator Nexus Kubernetes cluster
1313

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.
14+
Throughout the lifecycle of your Azure Operator Nexus Kubernetes cluster, you eventually need to directly access a cluster node. This access could be for maintenance, log collection, or troubleshooting operations. You access a node through authentication, which methods vary depending on your method of connection. You securely authenticate against cluster nodes through two options discussed in this article. For security reasons, cluster nodes aren't exposed to the internet. Instead, to connect directly to cluster nodes, you need to use either `kubectl debug` or the host's IP address from a jumpbox.
2315

2416
## Prerequisites
2517

2618
* An Azure Operator Nexus Kubernetes cluster deployed in a resource group in your Azure subscription.
2719
* 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.
20+
* To SSH using the node IP address, you must deploy a jumpbox VM on the same Container Network Interface (CNI) network as the cluster nodes.
2921

30-
## Connected mode access
22+
## Access to cluster nodes via Azure Arc for servers
3123

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.
24+
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, making it a quick and efficient method for remote management.
3325

34-
### Azure Arc for Kubernetes
26+
> [!NOTE]
27+
> Operator Nexus Kubernetes cluster nodes are Arc connected servers by default.
3528
36-
[!INCLUDE [quickstart-cluster-connect](./includes/kubernetes-cluster/cluster-connect.md)]
29+
1. Set the required variables. Replace the placeholders with the actual values relevant to your Azure environment and Nexus Kubernetes cluster.
3730

38-
### Access to cluster nodes via Azure Arc for Kubernetes
39-
Once you are connected to a cluster via Arc for Kuberentes, you can connect to individual Kubernetes Node using the `kubectl debug` command to run a privileged container on your node.
31+
```bash
32+
RESOURCE_GROUP="myResourceGroup" # Resource group where the Nexus Kubernetes cluster is deployed
33+
CLUSTER_NAME="myNexusK8sCluster" # Name of the Nexus Kubernetes cluster
34+
SUBSCRIPTION_ID="<Subscription ID>" # Azure subscription ID
35+
ADMIN_USERNAME="azureuser" # Username for the cluster administrator (--admin-username parameter value used during cluster creation)
36+
SSH_PRIVATE_KEY_FILE="<vm_ssh_id_rsa>" # Path to the SSH private key file
37+
MANAGED_RESOURCE_GROUP=$(az networkcloud kubernetescluster show -n $CLUSTER_NAME -g $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID --output tsv --query managedResourceGroupConfiguration.name)
38+
```
4039

41-
1. List the nodes in your Nexus Kubernetes cluster:
40+
2. Get the available cluster node names.
4241

43-
```console
44-
$> kubectl get nodes
45-
NAME STATUS ROLES AGE VERSION
46-
cluster-01-627e99ee-agentpool1-md-chfwd Ready <none> 125m v1.27.1
47-
cluster-01-627e99ee-agentpool1-md-kfw4t Ready <none> 125m v1.27.1
48-
cluster-01-627e99ee-agentpool1-md-z2n8n Ready <none> 124m v1.27.1
49-
cluster-01-627e99ee-control-plane-5scjz Ready control-plane 129m v1.27.1
42+
```azurecli-interactive
43+
az networkcloud kubernetescluster show --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID -o json | jq '.nodes[].name'
5044
```
5145

52-
2. Start a privileged container on your node and connect to it:
46+
3. Sample output:
5347

54-
```console
55-
$> kubectl debug node/cluster-01-627e99ee-agentpool1-md-chfwd -it --image=mcr.microsoft.com/cbl-mariner/base/core:2.0
56-
Creating debugging pod node-debugger-cluster-01-627e99ee-agentpool1-md-chfwd-694gg with container debugger on node cluster-01-627e99ee-agentpool1-md-chfwd.
57-
If you don't see a command prompt, try pressing enter.
58-
root [ / ]#
48+
```bash
49+
"mynexusk8scluster-0b32128d-agentpool1-md-7h9t4"
50+
"mynexusk8scluster-0b32128d-agentpool1-md-c6xbs"
51+
"mynexusk8scluster-0b32128d-control-plane-qq5jm"
5952
```
6053

61-
This privileged container gives access to the node. Execute commands on the baremetal host machine by running `chroot /host` at the command line.
62-
63-
3. When you are done with a debugging pod, enter the `exit` command to end the interactive shell session. After exiting the shell, make sure to delete the pod:
54+
4. Set the cluster node name to the VM_NAME variable.
6455

6556
```bash
66-
kubectl delete pod node-debugger-cluster-01-627e99ee-agentpool1-md-chfwd-694gg
57+
VM_NAME="mynexusk8scluster-0b32128d-agentpool1-md-7h9t4"
6758
```
6859

69-
### Azure Arc for servers
60+
5. Run the following command to SSH into the cluster node.
7061

71-
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.
62+
```azurecli-interactive
63+
az ssh arc --subscription $SUBSCRIPTION_ID \
64+
--resource-group $MANAGED_RESOURCE_GROUP \
65+
--name $VM_NAME \
66+
--local-user $ADMIN_USERNAME \
67+
--private-key-file $SSH_PRIVATE_KEY_FILE
68+
```
7269

73-
1. Set the required variables.
70+
## Access nodes using the Kubernetes API
7471

75-
```bash
76-
RESOURCE_GROUP="myResourceGroup"
77-
CLUSTER_NAME="myNexusK8sCluster"
78-
SUBSCRIPTION_ID="<Subscription ID>"
79-
USER_NAME="azureuser"
80-
SSH_PRIVATE_KEY_FILE="<vm_ssh_id_rsa>"
81-
MANAGED_RESOURCE_GROUP=$(az networkcloud kubernetescluster show -n $CLUSTER_NAME -g $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID --output tsv --query managedResourceGroupConfiguration.name)
82-
```
72+
This method requires usage of `kubectl debug` command. This method is limited to containers and may miss wider system issues, unlike SSH (using 'az ssh arc' or direct IP), which offers full node access and control.
8373

84-
2. Get the available cluster node names.
74+
### Access to Kubernetes API via Azure Arc for Kubernetes
8575

86-
```azurecli
87-
az networkcloud kubernetescluster show --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID -o json | jq '.nodes[].name'
76+
[!INCLUDE [quickstart-cluster-connect](./includes/kubernetes-cluster/cluster-connect.md)]
77+
78+
### Access to cluster nodes via Azure Arc for Kubernetes
79+
80+
Once you're connected to a cluster via Arc for Kubernetes, you can connect to individual Kubernetes node using the `kubectl debug` command to run a privileged container on your node.
81+
82+
1. List the nodes in your Nexus Kubernetes cluster:
83+
84+
```console
85+
$> kubectl get nodes
86+
NAME STATUS ROLES AGE VERSION
87+
mynexusk8scluster-0b32128d-agentpool1-md-7h9t4 Ready <none> 125m v1.24.9
88+
mynexusk8scluster-0b32128d-agentpool1-md-c6xbs Ready <none> 125m v1.24.9
89+
mynexusk8scluster-0b32128d-control-plane-qq5jm Ready <none> 124m v1.24.9
8890
```
8991
90-
3. Sample output:
92+
2. Start a privileged container on your node and connect to it:
9193
92-
```bash
93-
"mynexusk8scluster-0b32128d-agentpool1-md-7h9t4"
94-
"mynexusk8scluster-0b32128d-agentpool1-md-c6xbs"
95-
"mynexusk8scluster-0b32128d-control-plane-qq5jm"
94+
```console
95+
$> kubectl debug node/mynexusk8scluster-0b32128d-agentpool1-md-7h9t4 -it --image=mcr.microsoft.com/cbl-mariner/base/core:2.0
96+
Creating debugging pod node-debugger-mynexusk8scluster-0b32128d-agentpool1-md-7h9t4-694gg with container debugger on node mynexusk8scluster-0b32128d-agentpool1-md-7h9t4.
97+
If you don't see a command prompt, try pressing enter.
98+
root [ / ]#
9699
```
97100

98-
4. Run the following command to SSH into the cluster node.
101+
This privileged container gives access to the node. Execute commands on the cluster node by running `chroot /host` at the command line.
99102

100-
```azurecli
101-
az ssh arc --subscription $SUBSCRIPTION_ID \
102-
--resource-group $MANAGED_RESOURCE_GROUP \
103-
--name <VM Name> \
104-
--local-user $USER_NAME \
105-
--private-key-file $SSH_PRIVATE_KEY_FILE
103+
3. When you're done with a debugging pod, enter the `exit` command to end the interactive shell session. After exiting the shell, make sure to delete the pod:
104+
105+
```bash
106+
kubectl delete pod node-debugger-mynexusk8scluster-0b32128d-agentpool1-md-7h9t4-694gg
106107
```
107108
108-
### Direct access to cluster nodes
109+
## Create an interactive shell connection to a node using the IP address
110+
111+
### Connect to the cluster node from Azure jumpbox
109112
110-
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.
113+
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 jumpbox VM. Using this approach, you can SSH into the cluster nodes, also execute `kubectl` commands against the cluster using the `kubeconfig` file.
111114

112-
## Disconnected mode access
115+
Reach out to your network administrator to set up a direct connection from Azure jumpbox VM to the cluster's CNI network.
113116
114-
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.
117+
### Connect to the cluster node from on-premises jumpbox
115118
116-
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.
119+
Establish direct access to the cluster's CNI (Container Network Interface) from within your on-premises jumpbox. This direct access enables you to SSH into the cluster nodes, and lets you execute `kubectl` commands using the `kubeconfig` file.
117120

118121
Reach out to your network administrator to set up this direct connection to the cluster's CNI network.
119122
@@ -133,7 +136,7 @@ Before you can connect to the cluster nodes, you need to find the IP address of
133136
134137
2. Execute the following command to get the IP address of the nodes.
135138
136-
```azurecli
139+
```azurecli-interactive
137140
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)}'
138141
```
139142

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ ms.service: azure-operator-nexus
1212
To access your cluster, you need to set up the cluster connect `kubeconfig`. After logging into Azure CLI with the relevant Microsoft Entra entity, you can obtain the `kubeconfig` necessary to communicate with the cluster from anywhere, even outside the firewall that surrounds it.
1313

1414
1. Set `CLUSTER_NAME`, `RESOURCE_GROUP` and `SUBSCRIPTION_ID` variables.
15-
```bash
15+
```azurecli-interactive
1616
CLUSTER_NAME="myNexusK8sCluster"
1717
RESOURCE_GROUP="myResourceGroup"
1818
SUBSCRIPTION_ID=<set the correct subscription_id>
1919
```
2020
2121
2. Query managed resource group with `az` and store in `MANAGED_RESOURCE_GROUP`
22-
```azurecli
22+
```azurecli-interactive
2323
az account set -s $SUBSCRIPTION_ID
2424
MANAGED_RESOURCE_GROUP=$(az networkcloud kubernetescluster show -n $CLUSTER_NAME -g $RESOURCE_GROUP --output tsv --query managedResourceGroupConfiguration.name)
2525
```
2626

2727
3. The following command starts a connectedk8s proxy that allows you to connect to the Kubernetes API server for the specified Nexus Kubernetes cluster.
28-
```azurecli
28+
```azurecli-interactive
2929
az connectedk8s proxy -n $CLUSTER_NAME -g $MANAGED_RESOURCE_GROUP &
3030
```
3131
3232
4. Use `kubectl` to send requests to the cluster:
3333
34-
```console
34+
```azurecli-interactive
3535
kubectl get pods -A
3636
```
3737
You should now see a response from the cluster containing the list of all nodes.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ ms.topic: include
66
ms.service: azure-operator-nexus
77
---
88

9-
You can now deploy the CNFs either directly via [cluster connect](../../howto-kubernetes-cluster-connect.md#connected-mode-access) or via [Azure Operator Service Manager](../../../operator-service-manager/azure-operator-service-manager-overview.md).
9+
You can now deploy the CNFs either directly via [cluster connect](../../howto-kubernetes-cluster-connect.md#access-nodes-using-the-kubernetes-api) or via [Azure Operator Service Manager](../../../operator-service-manager/azure-operator-service-manager-overview.md).

0 commit comments

Comments
 (0)