Code Monkey home page Code Monkey logo

pycaret-deployment-azure's Introduction

Deployment on Microsoft Azure Kubernetes Service (AKS) using docker container

The following commands can be used in Azure Cloud Shell via the browser. First you need to login to Azure Portal then click on Cloud Shell using Bash. You can see steps by steps instruction here.

# setup variables to use
RESOURCE_GROUP=PYCARET-KUBE-RG
CLUSTER_NAME=PYCARET-AKS
ACR_NAME=pycaretacr

# create resource group, make sure the resource gropu name is new so we can cleanup at the end
az group create --name $RESOURCE_GROUP --location westus2

# create Aure Container Registry (ACR)
az acr create --resource-group $RESOURCE_GROUP --name $ACR_NAME --sku Premium

# clone the git repo and go into repo directory
# git clone https://...
cd pycaret-deployment-azure

# build and put the docker image to Azure registry
az acr build --registry $ACR_NAME --image pycaret-ins-5000:v1 .

# create kubernetes cluster
az aks create \
    --resource-group $RESOURCE_GROUP \
    --name $CLUSTER_NAME \
    --node-count 2 \
    --enable-addons http_application_routing \
    --enable-managed-identity \
    --generate-ssh-keys \
    --node-vm-size Standard_B2s

# add node pool
az aks nodepool add \
    --resource-group $RESOURCE_GROUP \
    --cluster-name $CLUSTER_NAME \
    --name mypool \
    --node-count 2 \
    --node-vm-size Standard_B2s 


# Setup credential to the AKS cluster
az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP

# Enable the access key using Azure portal on ACR
# Copy the username and primary key for below command

# Create Kubernetes secret with username and password for access to private registry
# updat the <USER_NAME> and <YOUR_KEY> for the command below
kubectl create secret docker-registry azure-reg-cred \
    --docker-username=<USER_NAME> \
    --docker-password=<YOUR_KEY> \
    --docker-server=pycaretacr.azurecr.io

# create deployment and service on AKS
kubectl apply -f azure_deployment.yaml

# check pod status for running status
kubectl get pod
# check for service ip
kubectl get service

# Your should be able to browse to the EXTERNAL-IP from above output and you should see the web interface

# Cleanup -- when done, use the command below to delete the resource group 
# this will also delete all the resources in this resource group so you don't incure any futher cost
az group delete --name $RESOURCE_GROUP --yes --no-wait

pycaret-deployment-azure's People

Contributors

phylypo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.