Skip to content

Commit 22849ed

Browse files
Merge pull request #9804 from circleci/onprem-2442/update-howto-access-external-nomad-ui
ONPREM-2442 | Access Nomad UI when using External Nomad Servers
2 parents 5498204 + 4d0ca78 commit 22849ed

File tree

2 files changed

+35
-28
lines changed

2 files changed

+35
-28
lines changed

docs/server-admin-4.8/modules/operator/pages/introduction-to-nomad-cluster-operation.adoc

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ image::guides:ROOT:nomad-diagram-v2.png[Diagram of the Nomad cluster]
1515

1616
- **Nomad client:** Nomad clients execute the jobs they are allocated by Nomad servers. Usually a Nomad client runs on a dedicated machine (often a VM) to take full advantage of machine power. You can have multiple Nomad clients to form a cluster and the Nomad server allocates jobs to the cluster with its scheduling algorithm.
1717
18-
- **Nomad jobs:** A Nomad job is a specification, provided by a user, that declares a workload for Nomad. A Nomad job corresponds to an execution of a CircleCI job. If the job uses xref:guides:optimize:parallelism-faster-jobs.adoc#[parallelism], for example `parallelism: 10`, then Nomad runs 10 jobs.
18+
- **Nomad jobs:** A Nomad job is a specification, provided by a user, that declares a workload for Nomad. A Nomad job corresponds to an execution of a CircleCI job. If the job uses parallelism, for example `parallelism: 10`, then Nomad runs 10 jobs. For more information on parallelism, see the xref:guides:optimize:parallelism-faster-jobs.adoc#[Test Splitting and Parallelism] guide.
1919
2020
- **Build agent:** Build agent is a Go program written by CircleCI that executes steps in a job and reports the results. Build agent is executed as the main process inside a Nomad job.
2121
@@ -31,9 +31,9 @@ The `nomad` CLI is installed in the Nomad pod. It is preconfigured to talk to th
3131

3232
The get a list of statuses for all jobs in your cluster, run the following command:
3333

34-
[source,shell]
34+
[source,console]
3535
----
36-
kubectl exec -it <nomad-server-pod-ID> -- nomad status
36+
$ kubectl exec -it <nomad-server-pod-ID> -- nomad status
3737
----
3838

3939
The `Status` is the most important field in the output, with the following status type definitions:
@@ -49,18 +49,18 @@ The `Status` is the most important field in the output, with the following statu
4949

5050
To get a list of your Nomad clients, run the following command:
5151

52-
[source,shell]
52+
[source,console]
5353
----
54-
kubectl exec -it <nomad-server-pod-ID> -- nomad node-status
54+
$ kubectl exec -it <nomad-server-pod-ID> -- nomad node-status
5555
----
5656

5757
NOTE: `nomad node-status` reports both Nomad clients that are currently serving (status `active`) and Nomad clients that were taken out of the cluster (status `down`). Therefore, you need to count the number of `active` Nomad clients to know the current capacity of your cluster.
5858

5959
To get more information about a specific client, run the following command from that client:
6060

61-
[source,shell]
61+
[source,console]
6262
----
63-
kubectl exec -it <nomad-server-pod-ID> -- nomad node-status -self
63+
$ kubectl exec -it <nomad-server-pod-ID> -- nomad node-status -self
6464
----
6565

6666
This gives information such as how many jobs are running on the client and the resource utilization of the client.
@@ -70,9 +70,9 @@ This gives information such as how many jobs are running on the client and the r
7070

7171
A Nomad job corresponds to an execution of a CircleCI job. Therefore, Nomad job logs can sometimes help to understand the status of a CircleCI job if there is a problem. To get logs for a specific job, run the following command:
7272

73-
[source,shell]
73+
[source,console]
7474
----
75-
kubectl exec -it <nomad-server-pod-ID> -- nomad logs -job -stderr <nomad-job-id>
75+
$ kubectl exec -it <nomad-server-pod-ID> -- nomad logs -job -stderr <nomad-job-id>
7676
----
7777

7878
NOTE: Be sure to specify the `-stderr` flag, as this is where most Build Agent logs appear.
@@ -83,30 +83,37 @@ Complete the following steps to get logs from the allocation of the specified jo
8383

8484
. Get the job ID with `nomad status` command.
8585
. Get the allocation ID of the job with `nomad status <job-id>` command.
86-
. Get the logs from the allocation with `nomad logs -stderr <allocation-id>`
86+
. Get the logs from the allocation with `nomad logs -stderr <allocation-id>`.
8787

8888
[#accessing-the-nomad-web-ui]
8989
=== Accessing the Nomad Web UI
9090

9191
Nomad provides a web UI for inspecting your Nomad cluster. If you are using an internalized Nomad deployment, which is the default setup with CircleCI server, follow the instructions in this section to temporarily access the UI for troubleshooting purposes. For a more permanent solution, consider externalizing Nomad and consult the official Nomad documentation for setting up routing.
9292

93-
. Nomad binds to its Pod IP. To port-forward to the Nomad service, you need to set up a lightweight tunneling mechanism within the cluster as follows:
93+
. When using Nomad in Kubernetes, it binds to its Pod IP address. Use the command below to fetch the IP address of the Nomad server:
9494
+
95-
[source,bash]
95+
[source,console]
9696
----
97-
export NOMAD_IP=$(kubectl get svc nomad-server -o jsonpath='{.spec.clusterIP}' -n <server-namespace>)
97+
$ export NOMAD_ADDR=$(kubectl get svc nomad-server -o jsonpath='{.spec.clusterIP}' -n <server-namespace>)
98+
----
99+
100+
. If using Externalized Nomad, Use Nomad Network Load Balancer or DNS address to port-forward to access the web UI.
98101

99-
kubectl run nomad-tunnel --rm -it --restart=Never --image=alpine/socat -n <server-namespace> -- TCP-LISTEN:4646,fork,reuseaddr TCP:$NOMAD_IP:4646
102+
. To port-forward to the Nomad service, set up a lightweight tunnelling mechanism within the cluster as follows:
103+
+
104+
[source,console]
105+
----
106+
$ kubectl run nomad-tunnel --rm -it --restart=Never --image=alpine/socat -n <server-namespace> -- TCP-LISTEN:4646,fork,reuseaddr TCP:$NOMAD_ADDR:4646
100107
----
101108

102109
. In another terminal, run the following command to set up port forwarding:
103110
+
104-
[source,bash]
111+
[source,console]
105112
----
106-
kubectl port-forward pod/nomad-tunnel 4646:4646 -n <server-namespace>
113+
$ kubectl port-forward pod/nomad-tunnel 4646:4646 -n <server-namespace>
107114
----
108115

109-
. Navigate to ++`http://localhost:4646/ui`++ in your browser to access the Nomad UI. For more information on utilizing the Nomad UI, refer to the link:https://developer.hashicorp.com/nomad/tutorials/web-ui[Nomad documentation].
116+
. Navigate to `++http[s]://localhost:4646/ui++` in your browser to access the Nomad UI. For more information on utilizing the Nomad UI, refer to the link:https://developer.hashicorp.com/nomad/tutorials/web-ui[Nomad documentation].
110117

111118
[#shutting-down-a-nomad-client]
112119
=== Shutting down a Nomad client
@@ -115,22 +122,22 @@ When you want to shut down a Nomad client, you must first set the client to `dra
115122

116123
. To drain a client, log in to the client and set the client to drain mode with `node-drain` command as follows:
117124
+
118-
[source,shell]
125+
[source,console]
119126
----
120-
nomad node-drain -self -enable
127+
$ nomad node-drain -self -enable
121128
----
122129
. Then, make sure the client is in drain mode using the `node-status` command:
123130
+
124-
[source,shell]
131+
[source,console]
125132
----
126-
nomad node-status -self
133+
$ nomad node-status -self
127134
----
128135

129136
Alternatively, you can drain a remote node with the following command, substituting the node ID:
130137

131-
[source,shell]
138+
[source,console]
132139
----
133-
nomad node-drain -enable -yes <node-id>
140+
$ nomad node-drain -enable -yes <node-id>
134141
----
135142

136143
[#scaling-down-the-client-cluster]
@@ -145,7 +152,7 @@ The script should use the commands in the section above to do the following:
145152
. Terminate the instance.
146153

147154
[#externalize-servers]
148-
== Externalize your Nomad Servers
155+
== Externalize your Nomad servers
149156
From server v4.8, Nomad Servers may now be deployed externally to your Kubernetes cluster that hosts your installation of CircleCI server. Externalization of Nomad Servers is optional. Externalization of Nomad Servers can improve their stability. If you already have a CircleCI server instance with _internal_ Nomad Servers, the process to switch to external Nomad Servers is as follows:
150157

151158
. Stop all builds on your CircleCI server instance.
@@ -155,5 +162,5 @@ ifndef::pdf[]
155162
[#next-steps]
156163
== Next steps
157164

158-
* Read the xref:managing-user-accounts.adoc#[Managing user accounts] guide.
165+
* Read the xref:managing-user-accounts.adoc#[Managing User Accounts] guide.
159166
endif::[]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
extends: existence
2-
message: "List items should end with a period (unless it's a single word or URL)."
2+
message: "List items should end with a period or colon (unless it's a single word or URL)."
33
link: https://github.com/circleci/circleci-docs
44
scope: list
55
level: error
66
raw:
7-
# Match items with at least 2 words that don't end with period or URL
8-
- '\S+\s+\S+.*[^.\s/]\s*$'
7+
# Match items with at least 2 words that don't end with period, colon, or URL
8+
- '\S+\s+\S+.*[^.\s/:]\s*$'

0 commit comments

Comments
 (0)