Deploy with Google's Kubernetes
Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It was developed by Google to handle the ops demand for an organization of that scale and the flexibility to run an infrastructure at any size.
To start, make sure you already have a Google Account. Sign in to the Google Cloud Platform and also sign up for a free trial on Google Container Registry and create a new project. Remember your project ID and use it on your command line:
$ export PROJECT_ID="your-project-id"
$ gcloud components install kubectl
We will use your Docker image from the "Deploy with Docker" section. Navigate to the docker
app folder and update the Dockerfile to the following:
FROM node:4.5 RUN npm i -g npm@3 EXPOSE 3000 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app COPY . /usr/src/app RUN npm install RUN /usr/src/app/node_modules/.bin/clap build CMD node server
Let's test out your image with Docker. Run the command below:
$ docker run -d -p 3000:3000 docker-awesome-container
Visit your app in the browser at
http://localhost:3000. You can stop running the container by using the command below:
$ docker stop docker-awesome-container
We can now push the image to the Google Container Registry. Your Docker images will be stored in a private repo that is accessible from every Google Cloud project as well as from outside the Google Cloud Platform.
$ gcloud docker push gcr.io/$PROJECT_ID/docker-awesome-container:v1