Skip to content

jagriti04/Software-Containerisation

Repository files navigation


Microk8s installation


  1. check if microk8s is installed
    -> microk8s status

  2. check mircok8s add-ons
    -> microk8s status (look for)

        --> dashboard
        --> dns
        --> helm (heml3)
        --> hostpath-storage
        --> ingress
        --> rbac
        --> registry
        --> storage
    

Paths


  1. create storage paths
    -> /var/lib/postgresql/data
    -> /mnt/data

Local docker images


  1. create the frontend & restapi images locally
    -> docker-compose build

  2. port the images to microk8s
    -> sudo docker save [image name] > [image name].tar
    -> sudo microk8s ctr image import [image name].tar

  3. check if images are in locall registry
    -> microk8s ctr images list (look for REF)
    --> docker.io/library/frontend:latest
    --> docker.io/library/restapi:latest


CERT-manager


  1. install cert-manager
    -> kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.11.0/cert-manager.yaml

GCP


  1. gcp artifcat registry create/ update
    -> sudo docker tag [image-name] europe-west4-docker.pkg.dev/sc-32-376820/survey-app/[image-name]:tag

  2. gcp push image
    -> docker push europe-west4-docker.pkg.dev/sc-32-376820/survey-app/[image-name]:tag

  3. create gcp compatible helm chart
    -> helm package .\surveyapp-helm\

  4. push compiled helm chart to gcp
    -> helm push surveyapp-helm-0.1.1.tgz oci://europe-west4-docker.pkg.dev/sc-32-376820/survey-app

  5. run the helm chart
    -> helm install [release-name] oci://europe-west4-docker.pkg.dev/sc-32-376820/survey-app/surveyapp-helm --version 0.1.1


Local helm chart


  1. run the helm chart
    -> sudo microk8s helm3 install [name] ./surveyapp-helm

  2. test role based access
    -> kubectl auth can-i get pod --namespace default --as sc


Database migration


  1. find the restapi pod name
    -> kubectl get pods (look for)
    --> restapi-deployment-[hash]

  2. connect to restapi pod
    -> kubectl exec -it restapi-deployment-[hash] /bin/bash

  3. migrate database to postgresql (inside pod terminal starts with #)
    -> python manage.py migrate

  4. exit pod terminal
    -> Ctrl + P


Operational


  1. check the port for the frontend
    -> kubectl get svc (look for)
    --> frontend-service (e.g., 4200:32478/TCP -> localhost:32478 is the IP)

  2. open a browser

  3. enter URL: localhost:[port] (e.g., localhost:32478)


Uninstalling


  1. uninstall helm chart
    -> sudo microk8s helm3 delete $(microk8s helm3 list --short)

  2. unistall specific chart
    -> helm uninstall [release-name]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published