docker image build -t react-app .
docker run -p 3000:3000 -d react-app
docker login
docker tag react-app <username>/repo-name:v1
docker push <username>/repo-name:v1
To deploy on Kubernetes, we need to create a local cluster for that supports all the features needed to run Kubernetes. Minikube is the best solution for it. minikube implements a local Kubernetes cluster on macOS, Linux, and Windows. minikube's primary goals are to be the best tool for local Kubernetes application development and to support all Kubernetes features that fit.
brew cask install minikube
minikube start
minikube dashboard
DOCKER_REGISTRY_SERVER=docker.io
DOCKER_USER=dhinkris
DOCKER_PASSWORD=
DOCKER_EMAIL=
kubectl create secret docker-registry regcred --docker-server=$DOCKER_REGISTRY_SERVER --docker-username=$DOCKER_USER --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL
kubectl get secret regcred --output=yaml
i) create deployment.yaml file that contains the deployment specific configurations that includes the name of the application, number of replicas/pods.
kubectl apply -f deployment.yaml
ii) Define a service on services.yaml. Here mention the port/protocal where the application has to run. Again run,
kubectl apply -f deployment.yaml