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: docs/how-to/h-deploy-aks.md
+72-28
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
[Azure Kubernetes Service](https://learn.microsoft.com/en-us/azure/aks/) (AKS) allows you to quickly deploy a production ready Kubernetes cluster in Azure. To access the AKS Web interface, go to [https://portal.azure.com/](https://portal.azure.com/).
4
4
5
5
## Summary
6
+
6
7
*[Install Azure and Juju tooling](#install-client-environment)
7
8
*[Create AKS Cluster](#create-aks-cluster)
8
9
*[Bootstrap Juju controller on AKS](#bootstrap-juju-controller-on-aks)
@@ -14,12 +15,16 @@
14
15
15
16
## Install Client Environment
16
17
18
+
Client environment includes:
19
+
* Juju
20
+
* Azure CLI
21
+
17
22
### Juju
18
23
19
24
Install Juju via snap:
20
25
21
26
```shell
22
-
sudo snap install juju
27
+
sudo snap install juju --channel 3.5/stable
23
28
```
24
29
25
30
Check that the Juju version is correctly installed:
@@ -28,11 +33,11 @@ Check that the Juju version is correctly installed:
28
33
juju version
29
34
```
30
35
31
-
which should show:
32
-
36
+
[details="Sample output:"]
33
37
```shell
34
38
3.5.2-genericlinux-amd64
35
39
```
40
+
[/details]
36
41
37
42
### Azure CLI
38
43
@@ -44,8 +49,7 @@ Verify that it is correctly installed running the command below:
44
49
az --version
45
50
```
46
51
47
-
which should show the following output:
48
-
52
+
[details="Sample output:"]
49
53
```shell
50
54
azure-cli 2.65.0
51
55
@@ -66,33 +70,38 @@ Legal docs and information: aka.ms/AzureCliLegal
66
70
67
71
Your CLI is up-to-date.
68
72
```
73
+
[/details]
69
74
70
75
## Create AKS cluster
71
76
72
77
Login to your Azure account:
78
+
73
79
```shell
74
80
az login
75
81
```
76
82
77
-
This following examples in this guide will use the single server AKS in location `eastus` - feel free to change this for your own deployment.
78
-
79
83
Create a new [Azure Resource Group](https://learn.microsoft.com/en-us/cli/azure/manage-azure-groups-azure-cli):
80
84
81
85
```shell
82
-
az group create --name aks --location eastus
86
+
az group create --name <RESOURCE_GROUP> --location <LOCATION>
83
87
```
84
88
85
-
Export the deployment name for further use:
86
-
```shell
87
-
export JUJU_NAME=aks-$USER-$RANDOM
88
-
```
89
+
The placeholder `<RESOURCE_GROUP>` can be a label of your choice, and it will be used to tag
90
+
the resources created on Azure. Also the following guide will use the single server AKS,
91
+
using `LOCATION=eastus` - but feel free to change this for your own deployment.
89
92
90
93
Bootstrap AKS with the following command (increase nodes count/size if necessary):
94
+
91
95
```shell
92
-
az aks create -g aks -n ${JUJU_NAME} --enable-managed-identity --node-count 1 --node-vm-size=Standard_D4s_v4 --generate-ssh-keys
96
+
az aks create -g <RESOURCE_GROUP> -n $<K8S_CLUSTER_NAME> --enable-managed-identity --node-count 1 --node-vm-size=<INSTANCE_TYPE> --generate-ssh-keys
93
97
```
94
98
95
-
Sample output:
99
+
[note type="caution"]
100
+
We recommend selecting an instance type that provides at the very least `16` GB of RAM and `4` cores, e.g. `Standard_A4_v4`.
101
+
You can find more information about the available instance types in the [Azure documentation](https://learn.microsoft.com/en-us/azure/virtual-machines/sizes/overview).
102
+
[/note]
103
+
104
+
[details="Sample output:"]
96
105
```yaml
97
106
{
98
107
"aadProfile": null,
@@ -110,17 +119,20 @@ Sample output:
110
119
"enableNodePublicIp": false,
111
120
...
112
121
```
122
+
[/details]
113
123
114
124
Dump newly bootstrapped AKS credentials:
125
+
115
126
```shell
116
-
az aks get-credentials --resource-group aks --name ${JUJU_NAME} --context aks
127
+
az aks get-credentials --resource-group <RESOURCE_GROUP> --name <K8S_CLUSTER_NAME> --context aks
117
128
```
118
129
119
-
Sample output:
130
+
[details="Sample output:"]
120
131
```shell
121
132
...
122
133
Merged "aks" as current context in~/.kube/config
123
134
```
135
+
[/details]
124
136
125
137
You can verify that the cluster and your client `kubectl` CLI is correctly configured by running a simple command, such as:
126
138
@@ -133,10 +145,12 @@ which should provide the list of the pod services running.
133
145
## Bootstrap Juju controller on AKS
134
146
135
147
Bootstrap Juju controller:
148
+
136
149
```shell
137
150
juju bootstrap aks <CONTROLLER_NAME>
138
151
```
139
-
Sample output:
152
+
153
+
[details="Sample output:"]
140
154
```shell
141
155
Creating Juju controller "aks" on aks/eastus
142
156
Bootstrap to Kubernetes cluster identified as azure/eastus
@@ -152,23 +166,28 @@ Now you can run
152
166
juju add-model <model-name>
153
167
to create a new model to deploy k8s workloads.
154
168
```
169
+
[/details]
155
170
156
171
## Deploy Charms
157
172
158
173
Create a new Juju model, if needed:
174
+
159
175
```shell
160
176
juju add-model <MODEL_NAME>
161
177
```
162
-
> (Optional) Increase the debug level if you are troubleshooting charms:
@@ -191,23 +210,42 @@ For more information on Data Integrator and how to use it, please refer to the [
191
210
## Display deployment information
192
211
193
212
Display information about the current deployments with the following commands:
213
+
214
+
```shell
215
+
kubectl cluster-info
216
+
```
217
+
218
+
[details="Sample output:"]
194
219
```shell
195
-
~$ kubectl cluster-info
196
220
Kubernetes control plane is running at https://aks-user-aks-aaaaa-bbbbb.hcp.eastus.azmk8s.io:443
197
221
CoreDNS is running at https://aks-user-aks-aaaaa-bbbbb.hcp.eastus.azmk8s.io:443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
198
222
Metrics-server is running at https://aks-user-aks-aaaaa-bbbbb.hcp.eastus.azmk8s.io:443/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
List all services and then delete those that have an associated EXTERNAL-IP value (load balancers, ...):
263
+
224
264
```shell
225
265
kubectl get svc --all-namespaces
226
-
kubectl delete svc <service-name>
266
+
kubectl delete svc <SERVICE_NAME>
227
267
```
268
+
228
269
Next, delete the AKS resources (source: [Deleting an all Azure VMs]((https://learn.microsoft.com/en-us/cli/azure/delete-azure-resources-at-scale#delete-all-azure-resources-of-a-type)))
270
+
229
271
```shell
230
-
az aks delete -g aks -n ${JUJU_NAME}
272
+
az aks delete -g <RESOURCE_GROUP> -n <K8S_CLUSTER_NAME>
231
273
```
232
-
Finally, logout from AKS to clean the local credentials (to avoid forgetting and leaking):
274
+
275
+
Finally, logout from AKS to clean the local credentials (to avoid forgetting and getting exposed to a risk of leaking credentials):
0 commit comments