Skip to content

Latest commit

 

History

History
95 lines (72 loc) · 4.55 KB

existing-k8s.md

File metadata and controls

95 lines (72 loc) · 4.55 KB

Getting Started on an Existing Kubernetes Instance

Before you start you need to get a Kubernetes cluster. If you just want to give this a try locally, you can use Docker for Desktop, Minikube or k3d. Either way make sure the VM has at least 2 CPUs and 6GB of RAM. Alternatively you can run this in the cloud - we use Google Kubernetes Engine. Make sure that whatever you use has a Kubernetes version <= 1.16.

  1. Install kubectl and helm 3.

  2. Fork this repository - this means you can make your own customisations, but still pull in updates.

  3. git clone it to your local machine open a terminal in the directory

  4. Install kubernetes-replicator to your cluster (as per instructions here) if you haven't done so.

  5. Look at values.yaml and make sure to customise the uncommented lines. Everything else can be left as default for now.

  6. Install create-secrets tool (if you haven't):

npm install --global @magda/create-secrets

After the installation, simply run create-secrets command anywhere from your commandline:

$ create-secrets

Output should look something like so:

magda-create-secrets tool 
? Are you creating k8s secrets for google cloud or local testing cluster? Local Testing Kubernetes Cluster
? Which local k8s cluster environment you are going to connect to? docker
? Do you need to access SMTP service for sending data request email? YES
? Please provide SMTP service username: abc
? Please provide SMTP service password: def
? Do you want to create google-client-secret for oAuth SSO? NO
? Do you want to create facebook-client-secret for oAuth SSO? NO
? Do you want to manually input the password used for databases? Generated password: up3Saeshusoequoo
? Specify a namespace or leave blank and override by env variable later? YES (Specify a namespace)
? What's the namespace you want to create secrets into (input `default` if you want to use the `default` namespace)? default
? Do you want to allow environment variables (see --help for full list) to override current settings at runtime? YES (Any environment variable can ove
ride my settings)
? Do you want to connect to kubernetes cluster to create secrets now? YES (Create Secrets in Cluster now)
Successfully created secret `smtp-secret` in namespace `default`.
Successfully created secret `db-passwords` in namespace `default`.
Successfully created secret `auth-secrets` in namespace `default`.
All required secrets have been successfully created!

Optional: If you're going to be triggering connector jobs from the admin-api (used by the admin UI), create the role binding this needs:

kubectl apply -f role-binding.yaml
  1. Add the magda chart repo to helm
helm repo add magda-io https://charts.magda.io
  1. Build the local chart
helm dep up ./chart
  1. Install magda
helm upgrade --install --timeout 9999s --debug magda ./chart

This will take a while for it to get everything set up.

  1. Connect to your instance:
  • On the cloud or docker for desktop Once helm is finished, run kubectl get services -w and wait for gateway to receive an external IP. It'll look something like this on kubectl or docker for desktop.
  • On minikube, you'll just have to run minikube ip and keep refreshing it with the node port below until it comes up.
gateway                           LoadBalancer   10.102.57.74     123.456.789.123     80:31519/TCP        1m

At this point you should be able to go to http://<external ip> in your browser and see the Magda UI. If you're not able to make this work, you should be able to run kubectl port-forward <gateway pod id> 30100:80 to make the service available on port 30100.

Note that the search won't work until it's finished indexing regions - to see the progress of this, run kubectl logs -f -lservice=indexer. Unless you've got a lot of processing power this will take quite a while - sorry! We're working on making it better.

By default, data.gov.au will be crawled on startup so you'll start with some data.

To update

  1. Merge the latest from this repository into yours.
  2. Run:
helm repo update
  1. Run:
helm upgrade --install --timeout 9999s --debug magda ./chart