@@ -24,78 +24,130 @@ To run all the commands on this page the user needs to have at least the followi
24
24
25
25
You will also need to have a role such as * Application Administrator* on the Azure Active Directory to be able to create the hopsworks.ai service principal.
26
26
27
- ## Step 1: Azure AKS Setup
27
+ ## Step 1: Azure Kubernetes Service ( AKS) Setup
28
28
29
29
### Step 1.1: Create an Azure Blob Storage Account
30
30
31
31
Create a storage account to host project data. Ensure that the storage account is in the same region as the AKS cluster for performance and cost reasons:
32
32
33
33
``` bash
34
- az storage account create --name $storage_account_name --resource-group $resource_group --location $region
34
+ az storage account create --name $STORAGE_ACCOUNT_NAME --resource-group $RESOURCE_GROUP --location $REGION
35
35
```
36
36
37
- Also create a corresponding container:
37
+ Also, create the corresponding container:
38
38
39
39
``` bash
40
- az storage container create --account-name $storage_account_name --name $container_name
40
+ az storage container create --account-name $STORAGE_ACCOUNT_NAME --name $CONTAINER_NAME
41
41
```
42
42
43
-
44
43
### Step 1.2: Create an Azure Container Registry (ACR)
45
44
46
45
Create an ACR to store the images used by Hopsworks:
47
46
48
47
``` bash
49
- az acr create --resource-group $resource_group --name $registry_name --sku Basic --location $region
48
+ az acr create --resource-group $RESOURCE_GROUP --name $CONTAINER_REGISTRY_NAME --sku Basic --location $REGION
49
+
50
+ export ACR_ID=` az acr show --name $CONTAINER_REGISTRY_NAME --resource-group $RESOURCE_GROUP --query " id" --output tsv`
50
51
```
51
52
52
- ### Step 1.3: Create an AKS Kubernetes Cluster
53
+ ### Step 1.3: Create a User-Assigned Managed Identity
53
54
54
- Provision an AKS cluster with a number of nodes :
55
+ Create a user-assigned managed identity to grant AKS access to the storage account and container registry :
55
56
56
57
``` bash
57
- az aks create --resource-group $resource_group --name $cluster_name --enable-cluster-autoscaler --min-count 1 --max-count 4 --node-count 3 --node-vm-size Standard_D16_v4 --network-plugin azure --enable-managed-identity --generate-ssh-keys
58
+ az identity create --name $UA_IDENTITY_NAME --resource-group $RESOURCE_GROUP
59
+
60
+ export UA_IDENTITY_PRINCIPAL_ID=` az identity show --name $UA_IDENTITY_NAME --resource-group $RESOURCE_GROUP --query principalId --output tsv`
61
+ export UA_IDENTITY_CLIENT_ID=` az identity show --name $UA_IDENTITY_NAME --resource-group $RESOURCE_GROUP --query clientId --output tsv`
62
+ export UA_IDENTITY_RESOURCE_ID=` az identity show --name $UA_IDENTITY_NAME --resource-group $RESOURCE_GROUP --query id --output tsv`
58
63
```
59
64
60
- ### Step 1.4: Retrieve setup Identifiers
65
+ ### Step 1.4: Grant permissions to the User-Assigned Managed Identity
61
66
62
- Create a set of environment variables for use in later steps.
67
+ Create a custom role definition with the minimum permissions needed to read and write to the storage account:
63
68
64
69
``` bash
65
- export managed_id=` az aks show --resource-group $resource_group --name $cluster_name --query " identity.principalId" --output tsv`
66
-
67
- export storage_id=` az storage account show --name $storage_account_name --resource-group $resource_group --query " id" --output tsv`
68
-
69
- export acr_id=` az acr show --name $registry_name --resource-group $resource_group --query " id" --output tsv`
70
+ export STORAGE_ID=` az storage account show --name $STORAGE_ACCOUNT_NAME --resource-group $RESOURCE_GROUP --query " id" --output tsv`
71
+
72
+ az role definition create --role-definition ' {
73
+ "Name": "hopsfs-storage-permissions",
74
+ "IsCustom": true,
75
+ "Description": "Allow HopsFS to access the storage container",
76
+ "Actions": [
77
+ "Microsoft.Storage/storageAccounts/blobServices/containers/write",
78
+ "Microsoft.Storage/storageAccounts/blobServices/containers/read",
79
+ "Microsoft.Storage/storageAccounts/blobServices/write",
80
+ "Microsoft.Storage/storageAccounts/blobServices/read",
81
+ "Microsoft.Storage/storageAccounts/listKeys/action"
82
+ ],
83
+ "NotActions": [],
84
+ "DataActions": [
85
+ "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/delete",
86
+ "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read",
87
+ "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/move/action",
88
+ "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write"
89
+ ],
90
+ "AssignableScopes": [
91
+ "' $STORAGE_ID ' "
92
+ ]
93
+ }'
94
+
95
+ az role assignment create --role hopsfs-storage-permissions --assignee-object-id $UA_IDENTITY_PRINCIPAL_ID --assignee-principal-type ServicePrincipal --scope $STORAGE_ID
70
96
```
71
97
72
- ### Step 1.5: Assign Roles to Managed Identity
98
+ ### Step 1.5: Create Service Principal for Hopsworks services
99
+
100
+ Create a service principal to grant Hopsworks applications with access to the container registry. For example, Hopsworks uses this service principal to push new Python environments created via the Hopsworks UI.
73
101
74
102
``` bash
75
- az role assignment create --assignee $managed_id --role " Storage Blob Data Contributor" --scope $storage_id
103
+ export SP_PASSWORD=` az ad sp create-for-rbac --name $SP_NAME --scopes $ACR_ID --role AcrPush --years 1 --query " password" --output tsv`
104
+ export SP_USER_NAME=` az ad sp list --display-name $SP_NAME --query " [].appId" --output tsv`
105
+ export SP_RESOURCE_ID=` az ad sp list --display-name $SP_NAME --query " [].id" --output tsv`
76
106
77
- az role assignment create --assignee $managed_id --role AcrPull --scope $acr_id
78
- az role assignment create --assignee $managed_id --role " AcrPush" --scope $acr_id
79
- az role assignment create --assignee $managed_id --role " AcrDelete" --scope $acr_id
107
+ az role assignment create --role AcrDelete --assignee-object-id $SP_RESOURCE_ID --assignee-principal-type ServicePrincipal --scope $ACR_ID
80
108
```
81
109
82
- ### Step 1.6: Allow AKS cluster access to ACR repository.
110
+ ### Step 1.6: Create an AKS Kubernetes Cluster
111
+
112
+ Provision an AKS cluster with a number of nodes:
83
113
84
114
``` bash
85
- az aks update --resource-group $resource_group --name $cluster_name --attach-acr $registry_name
115
+ az aks create --resource-group $RESOURCE_GROUP --name $KUBERNETES_CLUSTER_NAME --network-plugin azure \
116
+ --enable-cluster-autoscaler --min-count 1 --max-count 4 --node-count 3 --node-vm-size Standard_D8_v4 \
117
+ --attach-acr $CONTAINER_REGISTRY_NAME \
118
+ --assign-identity $UA_IDENTITY_RESOURCE_ID --assign-kubelet-identity $UA_IDENTITY_RESOURCE_ID \
119
+ --enable-managed-identity --generate-ssh-keys
86
120
```
87
121
88
122
## Step 2: Configure kubectl
89
123
90
124
``` bash
91
- az aks get-credentials --resource-group $resource_group --name $cluster_name --file ~ /my-aks-kubeconfig.yaml
125
+ az aks get-credentials --resource-group $RESOURCE_GROUP --name $KUBERNETES_CLUSTER_NAME --file ~ /my-aks-kubeconfig.yaml
92
126
export KUBECONFIG=~ /my-aks-kubeconfig.yaml
93
127
kubectl config current-context
94
128
```
95
129
96
- ## Step 3: Setup Hopsworks for Deployment
130
+ ## Step 3: Create Secret for the Service Principal
131
+
132
+ ### Step 3.1: Create Hopsworks namespace
133
+
134
+ ``` bash
135
+ kubectl create namespace hopsworks
136
+ ```
97
137
98
- ### Step 3.1: Add the Hopsworks Helm repository
138
+ ### Step 3.2: Create secret
139
+
140
+ ``` bash
141
+ kubectl create secret docker-registry azregcred \
142
+ --namespace hopsworks \
143
+ --docker-server=$CONTAINER_REGISTRY_NAME .azurecr.io \
144
+ --docker-username=$SP_USER_NAME \
145
+ --docker-password=$SP_PASSWORD
146
+ ```
147
+
148
+ ## Step 4: Setup Hopsworks for Deployment
149
+
150
+ ### Step 4.1: Add the Hopsworks Helm repository
99
151
100
152
To obtain access to the Hopsworks helm chart repository, please obtain
101
153
an evaluation/startup licence [ here] ( https://www.hopsworks.ai/try ) .
@@ -108,34 +160,49 @@ helm repo add hopsworks $HOPSWORKS_REPO
108
160
helm repo update hopsworks
109
161
```
110
162
111
- ### Step 3.2: Create Hopsworks namespace
112
-
113
- ``` bash
114
- kubectl create namespace hopsworks
115
- ```
116
-
117
- ### Step 3.3: Create helm values file
163
+ ### Step 4.2: Create helm values file
118
164
119
165
Below is a simplifield values.azure.yaml file to get started which can be updated for improved performance and further customisation.
120
166
121
- ``` bash
167
+ ``` yaml
122
168
global :
123
169
_hopsworks :
124
170
storageClassName : null
125
- cloudProvider: " AWS "
126
- managedDockerRegistry :
171
+ cloudProvider : " AZURE "
172
+ managedDockerRegistery :
127
173
enabled : true
128
- domain: " rchopsworksrepo .azurecr.io"
174
+ domain : " CONTAINER_REGISTRY_NAME .azurecr.io"
129
175
namespace : " hopsworks"
130
-
131
- managedObjectStorage:
132
- enabled: true
133
- endpoint: " https://rchopsworksbucket.blob.core.windows.net "
176
+ credHelper :
177
+ enabled : false
178
+ secretName : " "
179
+
134
180
minio :
135
181
enabled : false
182
+
183
+ hopsworks :
184
+ variables :
185
+ docker_operations_managed_docker_secrets : &azregcred "azregcred"
186
+ docker_operations_image_pull_secrets : *azregcred
187
+ dockerRegistry :
188
+ preset :
189
+ usePullPush : false
190
+ secrets :
191
+ - *azregcred
192
+
193
+ hopsfs :
194
+ objectStorage :
195
+ enabled : true
196
+ provider : " AZURE"
197
+ azure :
198
+ storage :
199
+ account : " STORAGE_ACCOUNT_NAME"
200
+ container : " STORAGE_ACCOUNT_CONTAINER_NAME"
201
+ identityClientId : " UA_IDENTITY_CLIENT_ID"
202
+
136
203
```
137
204
138
- ## Step 4 : Deploy Hopsworks
205
+ ## Step 5 : Deploy Hopsworks
139
206
140
207
Deploy Hopsworks in the created namespace.
141
208
@@ -157,9 +224,7 @@ Upon completion (circa 20 minutes), setup a load balancer to access Hopsworks:
157
224
kubectl expose deployment hopsworks --type=LoadBalancer --name=hopsworks-service --namespace < namespace>
158
225
```
159
226
160
-
161
-
162
- ## Step 5: Next steps
227
+ ## Step 6: Next steps
163
228
164
229
Check out our other guides for how to get started with Hopsworks and the Feature Store:
165
230
0 commit comments