We are now ready to deploy your image with GKE. If not yet created, GKE can create a new VPC as well as the other components that are required to serve your application. GKE will then authenticate, pull the image from Artifactory and deploy the container to the GKE.
1 . Remember the kubernetes cluster we created in the beginning of the lab? It must be ready by now. Let’s establish connectivity to it with the following command.
gcloud container clusters get-credentials gcpworkshop --project=$PROJECT_ID --zone=$REGION
kubectl get nodes
kubectl create namespace clouddays
kubectl create secret docker-registry regcred --namespace clouddays --docker-server=$JFROG_SERVER_NAME --docker-username=$JFROG_USER --docker-password=$JFROG_API_KEY
export IMAGE_NAME=$JFROG_SERVER_NAME/clouddays/npm-app:latest
echo $IMAGE_NAME
sed "s|imageName|$IMAGE_NAME|g" deployment.yaml > my-deployment.yaml
kubectl apply -f my-deployment.yaml --namespace clouddays
kubectl get pods --namespace clouddays -w
You should see you npm-app pod.
kubectl get services --namespace clouddays -w
This will provide the EXTERNAL-IP.