- NX
- docker
- kubectl
- minikube
- virtualbox
npm install -g nx
brew update
brew install kubectl
brew cask install docker
brew cask install minikube
brew cask install virtualbox
install nx
npm install -g nx
To install docker, follow the instructions here: https://docs.docker.com/engine/install/ubuntu/
Install docker-compose
sudo apt install docker-compose
Docker Desktop works on Mac and Windows only. A proper alternative is dockstation app: https://dockstation.io/
To install kubectl follow the instructions here: https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/
To install minikube follow the instructions here: https://minikube.sigs.k8s.io/docs/start/
To install virtualbox follow the instructions here: https://www.virtualbox.org/wiki/Linux_Downloads
kubectl version --client
docker --version
docker-compose --version
docker-machine --version
minikube version
Open docker desktop standalone app
minikube start
kubectl get nodes
You should see something like that
NAME STATUS ROLES AGE VERSION
minikube Ready master 40s v1.14.0
You can run the following commands with you NX IDE extension (vscode or intellij)
nx run svc-cart:dockerBuild
nx run svc-products:dockerBuild
nx run svc-user:dockerBuild
Check whether docker images has been created
docker images --format "table {{.ID}}\t{{.Tag}}\t{{.Repository}}"
You should see something like that
IMAGE ID TAG REPOSITORY
9d280d1feec7 latest svc-user
01a97cac7c74 latest svc-products
73de4fa41b44 latest svc-cart
8768eddc4356 v0.0.25 gcr.io/k8s-minikube/kicbase
You can run the following commands with your IDE's NX extension (vscode or intellij)
nx run svc-cart:kubernetesDeploy
nx run svc-products:kubernetesDeploy
nx run svc-user:kubernetesDeploy
kubectl get pods
NAME READY STATUS RESTARTS AGE
svc-cart-8b6dfcfb4-tzccw 1/1 Running 0 39m
svc-products-5b9d7478b-5r5zq 1/1 Running 0 14m
svc-user-5c59cb6776-gdt2h 1/1 Running 0 5m54s
kubectl get services
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 18h
svc-cart-service NodePort 10.99.159.203 <none> 80:32180/TCP 25m
svc-products-service NodePort 10.105.26.125 <none> 80:30915/TCP 16m
svc-user-service NodePort 10.102.239.226 <none> 80:32085/TCP 8m13s
minikube service svc-cart-service --url
You will see something like that:
π Starting tunnel for service svc-cart-service.
|-----------|------------------|-------------|------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|------------------|-------------|------------------------|
| default | svc-cart-service | | http://127.0.0.1:53401 |
|-----------|------------------|-------------|------------------------|
http://127.0.0.1:53401
β Because you are using a Docker driver on darwin, the terminal needs to be open to run it.
You should see:
{"message":"Welcome to svc-cart!"}
==============================================
minikube dashboard
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Mac:
brew install argocd
Linux and Windows:
https://argoproj.github.io/argo-cd/cli_installation/
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
kubectl -n argocd patch secret argocd-secret \
-p '{"stringData": {"admin.password": "$2a$10$mivhwttXM0U5eBrZGtAG8.VSRL1l9cZNAmaSaqotIzXRBRwID1NT.",
"admin.passwordMtime": "'$(date +%FT%T)'"
}}'
argocd login localhost:8080 --username admin --password admin --insecure
kubectl port-forward svc/argocd-server -n argocd 8080:443
user: admin
password: admin
Click on NEW APP
button
Application Name: cart-service
Project: default
Repository URL: https://github.com/ruslan-byondxr/node-ms-deployment
We are going to use separate git repo for our deployment config files. It's best practice in the industry.
The use of a different Git repository to hold your kubernetes manifests (separate from your application source code), is highly recommended. See best practices for further rationale. https://argoproj.github.io/argo-cd/user-guide/best_practices/
Path: svc-cart
Cluster URL: https://kubernetes.default.svc
Namespace: microservices
kubectl port-forward -n microservices svc/svc-cart 7000:8080
Open up your browser: http://localhost:7000/api
Now you should see a json response:
{"message":"Welcome to svc-cart!"}