Skip to content

This repository will provide you with a simple python application to calculate factorial of a number along with steps and other files required to setup a Kubernetes cluster using Google Cloud Platform

License

Notifications You must be signed in to change notification settings

Hardik-7892/Simple-Factorial-Website-Using-Kubernetes-and-Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Website creation using kubernetes and docker

To access the app, visit http://34.69.43.90/ followed by argument. In this case, it will be something like "factorial?number=" followed by a number

Reference example http://34.69.43.90/factorial?number=8

while trying to copy this project, make sure to edit the deployment.yaml file, your docker build and push command should change accordingly.

Sample Build process (Using Google Cloud):

  1. setup billing and enable API

    • Kubernetes Engine API
    • Container Registry API
    • Artifact Registry API
  2. Open cloud shell

  3. add files, either via upload, or create using your favourite editor (mine is nano)

  4. Create Docker image

    • command for creating docker image
      • docker build -t gcr.io/GCP_PROJECT_ID/factorial-app .
      • docker push gcr.io/GCP_PROJECT_ID/factorial-app
    • Change the repository location! use that to edit the deployment file too.
  5. Create Kubernetes Cluster

    • command for creating cluster
      • gcloud container clusters create factorial-cluster --zone us-central1-c --num-nodes=3
      • gcloud container clusters get-credentials factorial-cluster --zone us-central1-c
    • Change according to your needs
  6. apply the deployment and service files using these commands

    • kubectl apply -f deployment.yaml
    • kubectl apply -f service.yaml
  7. Verify using these commands

    • kubectl get nodes
    • kubectl get services
  8. After you get the external ip address of the load-balancer, access your project using

    • EXTERNAL_IP_ADDRESS/factorial?number=8
    • change number and check if it works

Note: Does not contain any fancy front-end, you are free to add it.

About

This repository will provide you with a simple python application to calculate factorial of a number along with steps and other files required to setup a Kubernetes cluster using Google Cloud Platform

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published