1. Configure Azure CLI

To manage your Kubernetes clusters on Azure, you’ll need to install the Azure CLI, which includes the kubectl command-line tool for interacting with Kubernetes clusters.

1.1 Install Azure CLI

To install the Azure CLI, follow the instructions below:

On macOS:

brew install azure-cli

On Windows:

Download and install the MSI from the Azure CLI download page.

On Linux:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash  

1.2 Install kubectl

Once Azure CLI is installed, you can use it to install kubectl:

az aks install-cli  

This command will automatically install the kubectl tool, which you can use to interact with your Kubernetes clusters.

1.3 Login to Azure CLI

After installing Azure CLI and kubectl, you need to log in to your Azure account:

az login

This will open a web browser and prompt you to log in with your Azure credentials. Once logged in, you’ll be able to manage your Azure resources through the command line.

1.4 Verify Installation

To ensure everything is set up correctly, you can check the versions of the installed tools:

az --version
kubectl version --client

You should see the version numbers of both Azure CLI and kubectl, confirming they are installed and ready to use.


2. Clone Repository Self Host

2.1 Setting Up Your GitHub Access Token for Cloning

2.1.1. Obtain Your Cloning Access Token

  • Reach out to the Duckie team for your cloning_access_token
  • You can contact us at founders@duckie.ai

2.1.2. Set up the token on your machine

Once you have received your cloning_access_token, follow these steps to set it up:

  1. Enter the following command, replacing your_cloning_access_token_here with the actual token you received:

    export GITHUB_TOKEN=your_cloning_access_token_here
    
  2. To verify that the token has been set correctly, you can echo the variable: This should display your token.

    echo $GITHUB_TOKEN
    

2.2 Clone the Git Repository

To clone a Git repository, you can use the git clone command. Follow the steps below:

  1. Open your terminal or command prompt.

  2. Use the following command to clone the repository:

    git clone https://github.com/musa-dev-team/duckie-selfhost.git
    

3. Create a new configsmaps.yaml file in the kube_setup directory


4. Deploy Using Kubernetes

4.1 Allow permissions

sudo chmod +x kube_setup.sh

This command changes the file permissions to make the script executable.

4.2 Deploy

./kube_setup.sh

5. Verify and delete the deployments

5.1 Check running services

The frontend, backend urls should be the external ip of the load balancer controller, which you can find from this command.

kubectl get services -n duckie                                          ─╯
NAME              TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)              AGE
duckie-backend    LoadBalancer   10.0.113.31    4.157.10.169   3002:32614/TCP       14h
duckie-frontend   LoadBalancer   10.0.107.107   4.156.28.168   80:32673/TCP         14h
weaviate          ClusterIP      10.0.165.203   <none>         8080/TCP,50051/TCP   2d14h

5.2 Monitor

Watch pod satus

kubectl get pods -n duckie -w

Setup debugger pod to debug network issues

kubectl run -it --rm debug --image=curlimages/curl -n duckie -- sh

Check open ports

kubectl exec -it weaviate-846f95c454-r6rzn -n duckie -- netstat -tulpn

Reading frontend and backend logs

kubectl logs -f -l app=duckie-backend -n duckie

5.3 Delete

delete and redeploy duckie services

kubectl delete deployment duckie-backend -n duckie
kubectl rollout restart deployment duckie-frontend -n duckie