-
Notifications
You must be signed in to change notification settings - Fork 18
Minikube setup for AngularPwaMessenger
The reason for the Minikube(version 1.0.0 required) setup is to make the AngularPwaMessenger easyly testable. With the tools of Kubernetes and Helm the the project can be setup and run without a local MongoDB. The Image of the project can be found at hub.docker.com.
For anything else than testing replace the 'jwtTokenSecrect' in the 'values.yaml' file with a random alphanumeric string of the same length or longer.
The project has a 2 Step process to make it run on Minikube:
Running the Helm chart for the basic setup. It runs with Firefox. Adding Ingress with a Tls cert to make it possible to use Chrome. Lets have a look at both steps.
To install the AngularPwaMessenger in Minikube you need to run:
helm delete –purge messenger
helm install ./ –name messenger –set serviceType=NodePort
The steps can be found in helm.sh.
Then the AngularPwaMessenger is available on a Port of Minikube.
The Minikube ip can be found by minikube ip
and the port can be found by kubectl get svc
. Then you can use the Messenger with Firefox.
The AngularPwaMessenger uses the crypto api of the browser and that is on Chrome only available if you use localhost or a trusted tls connection. For Chrome a second step is needed.
First check your Minikube ip. If it is 192.168.99.100 you can use the selfsigned Tls certificates of the project otherwise you need to make your own. Make sure that the ingress addon is enabled in minikube.
add a the line 192.168.99.100 minikube
to the hosts file of your OS.
add Ingress to Minikube. Ingress can route, loadbalance and add Tls.
run kubectl create secret tls minikube-tls –cert=ca.crt –key=ca.key
to add the Tls certificates to Minikube.
run kubectl create -f ./ingress.yaml
to setup ingress to support Tls and send the requests to ‘minikube’ to the
angularpwa pod. If ingress already exists run kubectl replace -f ./ingress.yaml
Open Chrome and add the ca.crt file in the settings under authorities and trust it for Ssl encrypted web sites.
The steps can be found in addIngress.sh.
Chrome and Firefox will show that the connection is unsafe but the crypto api works and the AngularPwaMessenger can be used.
If your Minikube ip is not 192.168.99.100 you need to make your own ca.crt and ca.key files. You need to put your Minikube ip in the hosts file and edit the csr.conf file. Replace 192.168.99.100 with your Minikube ip and run these commands to create your certificate:
openssl genrsa -out ca.key 2048
openssl req -x509 -new -key ca.key -sha256 -nodes -keyout ca.key -out ca.crt -subj “/CN=minikube” -days 3650
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr -config csr.conf
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 3650 -extensions v3_ext -extfile csr.conf
The steps can be found in addIngress.sh.
Then you can use the Minikube setup too.