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
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/multiarch_nginx_on_aks/1-deploy-intel.md
+42-33Lines changed: 42 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,17 +8,16 @@ layout: learningpathall
8
8
9
9
## Deployment and service
10
10
11
-
In this section, you'll add a new namespace, deployment, and service for nginx on Intel. The end result will be a K8s cluster running nginx accessible via the Internet through a load balancer.
11
+
In this section, you'll add a new namespace, deployment, and service for nginx on Intel. The end result will be a K8s cluster running nginx accessible via the Internet through a load balancer.
12
12
13
13
To better understand the individual components, the configuration is split into two files:
14
14
15
-
1.Applying the namespace.yaml creates a new namespace called `nginx`, which contains all your K8s nginx objects.
15
+
1.**namespace.yaml** - Creates a new namespace called `nginx`, which contains all your K8s nginx objects
16
16
17
-
2. Applying the intel_nginx.yaml creates the following K8s objects:
18
-
19
-
2.1. A K8s deployment called `nginx-intel-deployment`. This deployment pulls a multi-architecture [nginx image](https://hub.docker.com/_/nginx) from DockerHub, and launches a pod for it on the x86 node.
20
-
21
-
2.2. A K8s load balancer service `nginx-intel-svc`, targeting any pod with the `arch: intel` label (the Intel deployment will create this pod).
17
+
2.**intel_nginx.yaml** - Creates the following K8s objects:
-**Deployment** (`nginx-intel-deployment`) - Pulls a multi-architecture [nginx image](https://hub.docker.com/_/nginx) from DockerHub, launches a pod on the Intel node, and mounts the ConfigMap as `/etc/nginx/nginx.conf`
20
+
-**Service** (`nginx-intel-svc`) - Load balancer targeting pods with both `app: nginx-multiarch` and `arch: intel` labels
22
21
23
22
24
23
The following commands download, create, and apply the namespace and Intel nginx deployment and service configuration:
Taking a closer look at the `intel_nginx.yaml` deployment file, you'll see some settings that ensure the deployment runs as we expect on the Intel node:
55
45
56
-
* The `nodeSelector``agentpool`, with the value of `intel`. This ensures that the deployment only runs on Intel nodes, utilizing the amd64 version of the nginx container image.
46
+
* The `nodeSelector``kubernetes.io/arch: amd64`. This ensures that the deployment only runs on x86_64 nodes, utilizing the amd64 version of the nginx container image.
57
47
58
48
```yaml
59
49
spec:
60
50
nodeSelector:
61
-
agentpool: intel
51
+
kubernetes.io/arch: amd64
62
52
```
63
53
64
54
* The A `sessionAffinity` tag, which removes sticky connections to the target pods. This removes persistent connections to the same pod on each request.
@@ -68,11 +58,20 @@ spec:
68
58
sessionAffinity: None
69
59
```
70
60
61
+
* The service selector uses both `app: nginx-multiarch` and `arch: intel` labels to target only Intel pods. This dual-label approach allows for both architecture-specific and multi-architecture service routing.
62
+
63
+
```yaml
64
+
selector:
65
+
app: nginx-multiarch
66
+
arch: intel
67
+
```
68
+
71
69
* Since the final goal is running nginx on multiple architectures, the deployment uses the standard nginx image from DockerHub. This image supports multiple architectures, including amd64 (Intel), arm64 (ARM), and others.
72
70
73
71
```yaml
74
-
- image: nginx:latest
75
-
name: nginx-multiarch
72
+
containers:
73
+
- image: nginx:latest
74
+
name: nginx
76
75
```
77
76
{{% notice Note %}}
78
77
Optionally, you can set the `default Namespace` to `nginx` to simplify future commands by removing the need to specify the `-nnginx` flag each time:
@@ -90,19 +89,29 @@ You've deployed the objects, so now it's time to verify everything is running as
90
89
kubectl get nodes,pods,svc -nnginx
91
90
```
92
91
93
-
Your output should be similar to the following, showing three nodes, one pod, and one service:
92
+
Your output should be similar to the following, showing two nodes, one pod, and one service:
0 commit comments