You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Connect to Azure Operator Nexus Kubernetes cluster
13
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.
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.
23
15
24
16
## Prerequisites
25
17
26
18
* An Azure Operator Nexus Kubernetes cluster deployed in a resource group in your Azure subscription.
27
19
* 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.
29
21
30
-
## Connected mode access
22
+
## Access to cluster nodes via Azure Arc for servers
31
23
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.
33
25
34
-
### Azure Arc for Kubernetes
26
+
> [!NOTE]
27
+
> Operator Nexus Kubernetes cluster nodes are Arc connected servers by default.
1. Set the required variables. Replace the placeholders with the actual values relevant to your Azure environment and Nexus Kubernetes cluster.
37
30
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
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"
59
52
```
60
53
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.
64
55
65
56
```bash
66
-
kubectl delete pod node-debugger-cluster-01-627e99ee-agentpool1-md-chfwd-694gg
5. Run the following command to SSH into the cluster node.
70
61
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.
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.
83
73
84
-
2. Get the available cluster node names.
74
+
### Access to Kubernetes API via Azure Arc for Kubernetes
85
75
86
-
```azurecli
87
-
az networkcloud kubernetescluster show --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID -o json | jq '.nodes[].name'
### 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:
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 [ / ]#
96
99
```
97
100
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.
99
102
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
106
107
```
107
108
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
109
112
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.
111
114
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.
113
116
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
115
118
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.
117
120
118
121
Reach out to your network administrator to set up this direct connection to the cluster's CNI network.
119
122
@@ -133,7 +136,7 @@ Before you can connect to the cluster nodes, you need to find the IP address of
133
136
134
137
2. Execute the following command to get the IP address of the nodes.
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.
13
13
14
14
1. Set `CLUSTER_NAME`, `RESOURCE_GROUP` and `SUBSCRIPTION_ID` variables.
15
-
```bash
15
+
```azurecli-interactive
16
16
CLUSTER_NAME="myNexusK8sCluster"
17
17
RESOURCE_GROUP="myResourceGroup"
18
18
SUBSCRIPTION_ID=<set the correct subscription_id>
19
19
```
20
20
21
21
2. Query managed resource group with `az` and store in `MANAGED_RESOURCE_GROUP`
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
29
29
az connectedk8s proxy -n $CLUSTER_NAME -g $MANAGED_RESOURCE_GROUP &
30
30
```
31
31
32
32
4. Use `kubectl` to send requests to the cluster:
33
33
34
-
```console
34
+
```azurecli-interactive
35
35
kubectl get pods -A
36
36
```
37
37
You should now see a response from the cluster containing the list of all nodes.
Copy file name to clipboardExpand all lines: articles/operator-nexus/includes/kubernetes-cluster/quickstart-nextsteps.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,4 +6,4 @@ ms.topic: include
6
6
ms.service: azure-operator-nexus
7
7
---
8
8
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