Giter Club home page Giter Club logo

helloworld-on-local-k8s's Introduction

Webserver Deployment for a locally run Kubernetes

Purpose

So you've setup a Raspberry Pi kubernetes cluster just as I did? Now you want to deploy the first applications on it but you are unsure how to start?

This repo is for you me.

Step by Step

First website

In this repo you can find a index.html directly in the root folder. Deploy it as a website to your Kubernetes (K8S) Cluster with the following commands.

kubectl create namespace helloworld
kubectl create configmap hello-world --from-file ./index.html --namespace helloworld
kubectl apply -f ./hello-world.yml --namespace helloworld

You will be able to reach that example page by either going on

Using your own Images

In the example before I used the nginx docker image. If deploying own apps it makes sense to build docker images yourself.

When using those docker images in Kubernetes you need to configure that you can login to dockerhub or whatever service you use.

Therefore I suggest you login using your docker client. Then you do the following

kubectl create secret docker-registry mysecretname \
--docker-server=https://ghcr.io \
--docker-username=xxx \
--docker-password=xxx \
--docker-email=xxx \
--namespace helloworld

or

kubectl create secret docker-registry mysecretname \
--from-file=.dockerconfigjson=path/to/.docker/config.json

When the kubernetes cluster is downloading your special docker images you might run into issues when you are building the images for a platform e.g. x86 but your cluster (in my case three arm64 Raspberry Pi 5) you have a different platform you will run into issues.

What needs to be done is that you build for the right platform.

I find it the most easy approach to do so with github actions.

helloworld-on-local-k8s's People

Contributors

spansky 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.