Skip to content

Kubernetes Locally

Aron Heesakkers edited this page Jun 10, 2021 · 10 revisions

Run Kubernetes locally.

First you need to get your LAN IP address

# macOS
ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' 

Example response:

192.168.1.74

For this example we'll use http://192.168.1.74 as an example, but you will have to change this value with your IP.

Database

We can use an external cloud database or we can spin one up in Docker. Anyhow we need a connectionstring.

If you don't use your own then do the following.

docker run -p 1433:1433 --name local_kube_db mcr.microsoft.com/mssql/server 

The connectionstring will be

Server=http://192.168.1.74:1433;Database=db_name;User=sa;Password=Your_password123;

Source

Build the UI

docker build -t ui --build-arg APP_URL=http://192.168.1.74 --build-arg GATEWAY_URL=http://192.168.1.74:30010 .

Build the gateway

Copy and paste appsettings.json and rename it to appsettings.k8s.json

Set the following values based on your IP.

  "PackageApiUrl": "http://192.168.1.74:30001",
  "LocationApiUrl": "http://192.168.1.74:30002",
  "PersonApiUrl": "http://192.168.1.74:30003"

Build the image with build-arg BUILD_ENV as defined in the Dockerfile. Set this variable to k8s to use appsettings.k8s.json.

docker build -t gateway --build-arg BUILD_ENV=k8s .

Build the others

Pakketservice

Copy and paste appsettings.json and rename it to appsettings.k8s.json

Set the following values based on your IP.

"ConnectionString": "Server=http://192.168.1.74:1433;Database=pakket_db;User=sa;Password=Your_password123;"

Build the image with build-arg BUILD_ENV as defined in the Dockerfile. Set this variable to k8s to use appsettings.k8s.json.

docker build -t pakketsvc --build-arg BUILD_ENV=k8s .

Locationservice

Copy and paste appsettings.json and rename it to appsettings.k8s.json

Set the following values based on your IP.

"ConnectionString": "Server=http://192.168.1.74:1433;Database=location_db;User=sa;Password=Your_password123;"

Build the image with build-arg BUILD_ENV as defined in the Dockerfile. Set this variable to k8s to use appsettings.k8s.json.

docker build -t locationsvc --build-arg BUILD_ENV=k8s .

Personeelservice

docker build -t personeelsvc .

Run it

Go to /docs/deployments/local and run

kubectl apply -f .



FIPost should now be available on 192.168.1.74:30080 (your ip might differ)!

Clone this wiki locally