Coder Social home page Coder Social logo

learning-k8s-static-website's Introduction

Static website on Kubernetes

Description

Learning task: Static website published on local Kubernetes cluster. Service is exposed through Ingress at my.dummy.domain Content of the website is located in ./contents/index.html

Requirements: kubernetes, kubectl, docker

Files:

  • kustomization.yml : file to generate custom ConfigMap
  • website_deployment.yml : Kubernetes deployment definition
  • contents/index.html : static website source code
  • README.md

Execution

  1. Run local Kubernetes cluster. I'm running Kubernetes on Docker Desktop

  2. Set a custom domain name on localhost, for example my.dummy.domain:

    • [Linux] add line 127.0.0.1 my.dummy.domain in /etc/hosts
    • [Windows] add the same line in /Windows/System32/drivers/etc/hosts
  3. Create NGINX ingress controller

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.2/deploy/static/provider/cloud/deploy.yaml

# Optional: check pod state
kubectl get pods --namespace=ingress-nginx
  1. Create the deployment
kubectl apply -k ./

# Optional: Preview of generated ConfigMap
kubectl kustomize ./
  1. Port forwarding. After running this command our service will be available at http://my.dummy.domain:8080
kubectl port-forward --namespace=ingress-nginx service/ingress-nginx-controller 8080:80

learning-k8s-static-website's People

Contributors

filiphagan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.