What To Eat And What To Avoid During Pregnancy For Perfect Health?

Essential food for Nourishing during pregnancy time. Pregnancy is a miraculous and transformative time in a woman’s life. As an expectant mother, your diet plays a crucial role in supporting your…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Deploying your NodeJS app with Docker and Kubernetes on GCP

This tutorial will be fairly easy to follow along, but some technical experience is recommended!

First, we need to configure some settings for you project:

This sets the current project to your project (in this case, mine is kube-tutorial-194819 and then it sets the default compute zone to us-west1-a

Now we’ll need to put your app into a Docker container so we can deploy it to the Kubernetes cluster that we’ll create.

Head to the root directory of your Node app and create a Dockerfile and .dockerignore file using your favorite shell editor:

nano Dockerfile and put this as its contents:

Next, we’ll make our .dockerignore file:

nano .dockerignore

Like .gitignore , a .dockerignore file tells the system which files and directories to ignore when building.

docker build -t gcr.io/kube-tutorial-194819/kube-tutorial:latest .

This builds our image with the tag:

gcr.io/kube-tutorial-194819/kube-tutorial:latest

Next we’ll go ahead and push to our private Container Registry:

gcloud docker -- push gcr.io/kube-tutorial-194819/kube-tutorial

Now that our app is Dockerized, we can set up our deployment.

This creates a cluster with the name kube-tutorial and then authenticates our shell to use the cluster.

Finally, we’ll run a deployment on our cluster:

This creates the Deployment and names it kube-tutorial using the image we just pushed to the Container Registry, then specifies the port that we’ll be exposing as 8080. Now let’s expose our Deployment to the world:

Now our app is deployed! To find the external IP that the Load Balancer gave us, run the command:

You’ll may see <pending> as the External-IP, but just wait a minute and re-run the command and eventually you’ll see it. Go ahead and enter that External-IP in to your browser, appending :8080 to specify the port.

Next time we’ll learn about versioning with Kubernetes and how easy it is to deploy updates to your application!

If you have any questions, comment below!

Add a comment

Related posts:

Nine VCs you can meet at SaaStock on Tour London

Meeting investors and scheduling back to back meetings with them in the same day is one of the priceless parts of SaaStock. We are bringing that same experience at each and every of the 12 SaaStock…

Delhi High Court has literally exposed the conspiracy that SK Hooda and Sunil Gandhi have been hatching

In a major relief for 1800 belaboured customers of AN Buildwell Pvt Ltd (currently under liquidation), on 15.02.2018 the Division Bench of the Delhi High Court dismissed a petition seeking to…

Easter in the Dominican Republic

Easter in the Dominican Republic is one of the of the most celebrated holidays of the year. The majority of those that live on the island are Catholic, so it is considered a time of both reflection…