inspired and update from : https://www.magalix.com/blog/deploying-an-application-on-kubernetes-from-a-to-z
cd step1/
docker build -t sample-api .
check context :
kubectl config get-contexts
select context:
kubectl config set-context docker-desktop
Create a namespace :
kubectl create namespace frontend
Change Namespace :
kubectl config set-context --current --namespace=frontend
# Validate it
kubectl config view --minify | grep namespace:
cd step2/
kubectl apply -f deployment.yaml
cd step3/
kubectl apply -f frontend-svc.yaml
Install Nginx ingress controller:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.2.0/deploy/static/provider/cloud/deploy.yaml
kubectl apply -f step3/ingress.yaml
kubectl port-forward services/frontend-svc 3000:3000
Creat a configmap:
cd step4/
kubectl apply -f configmap.yml
kubectl create secret generic redis-password --from-literal=redis-password=password123
Note : uncomment and redeploy deployment in step 2, then check its status. You did it!