
This project is a simple Node.js app, demonstration of DevOps practices, showing the usage of Docker and deployment of a basic application using Google Cloud Platform (GCP) services and Kubernetes.
Explore the docs »To get started with the Hello World DevOps project, follow the steps below. These instructions will guide you through the setup process and demonstrate how to deploy the sample application on Google Cloud Platform using Docker and Kubernetes.
Before proceeding with the Hello World DevOps project, ensure that you have the following prerequisites in place:
- Google Cloud Platform (GCP) Account: You should have a Google Cloud Platform account. If you don't have one, you can sign up with this link: Google Cloud Console.
- Google Cloud SDK: Download Google Cloud SDK to run "gcloud" commands Google Cloud SDK documentation.
- Git: Make sure you have Git installed on your local machine. You can download Git from the official Git website.
- Docker: Install Docker on your local machine. Docker will be used to build and create containers for the app. You can download Docker from the official Docker website.
- Clone the repo
git clone [email protected]:ibrahimakkaya/hello-world-devops.git
- Change folder
cd hello-world-devops
- We will make some changes in files, but we will do this in the deployment part.
Follow the steps below to deploy the Hello World DevOps application on Google Cloud Platform using Kubernetes:
-
Login Google Cloud and authenticate.
gcloud auth login
-
Create a Google Cloud project named {PROJECT_NAME}.
gcloud projects create {PROJECT_NAME}
-
To see PROJECT_ID.
gcloud projects list
-
To set desired project as default.
gcloud config set project {PROJECT_ID}
-
Enable the necessary Google Cloud services for this project:
gcloud services enable container.googleapis.com
-
Create a Kubernetes cluster name what you want, a 1 node basic hardware: (This process will take a little longer, because of this prefer to do it early.)
gcloud container clusters create {CLUSTER_NAME} --num-nodes=1 --machine-type=n1-standard-1
-
Create Google Cloud Artifacts with your configuration repository for store Docker image:
gcloud config get-value compute/region gcloud artifacts repositories create {REPO_NAME} --project={PROJECT_ID} --repository-format=docker --location={REGION} --description="Docker Repo"
-
Build the Docker image and push it to the Google Cloud Artifacts repository: (Container name can be anything you want)
gcloud builds submit --tag {REGION}-docker.pkg.dev/{PROJECT_ID}/{REPO_NAME}/{CONTAINER_NAME} .
-
Open downloaded repository, open deployment.yaml and change the lines as they specified on comments.
-
Deploy the application using the Kubernetes manifest specified in the deployment.yaml file:
kubectl apply -f deployment.yaml
-
Verify that the deployment is successful:
kubectl get deployments
-
Create a Kubernetes service to expose the application:
kubectl apply -f service.yaml
-
Wait until to see External IP:
kubectl get services
-
You can access simple Node.js app with external IP.
Demo Link: Hello World
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Branch (
git checkout -b feature
) - Commit your Changes (
git commit -m 'Add some feature'
) - Push to the Branch (
git push origin main
) - Open a Pull Request
Halil Ibrahim Akkaya - Medium
Project Link: https://github.com/ibrahimakkaya/hello-world-devops