Coder Social home page Coder Social logo

rremu / ckad-study-apps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from james65535/ckad-study-apps

0.0 1.0 0.0 5 KB

A set of simple applications to aid in studying for the Certified Kubernetes Application Develop exam

Dockerfile 7.65% Go 89.50% Shell 2.85%

ckad-study-apps's Introduction

ckad-study-apps

A set of simple applications to aid in studying for the Certified Kubernetes Application Develop exam. The associated YAML manifests are quite basic and can be modified extensively to suite your studying needs. For example:

  • Configure to use Persistent Volumes
  • Secrets
  • Resource Requests and Limits
  • Network Policies
  • etc...

You can just deploy the apps via the YAML manifests within the k8sconfigs folder which will pull from public docker images. Or if you would like to modify the application source files and build from scratch, instructions are listed below.

Ambassador App

The ambassador app is a simple go webserver which gets and sets key value pairs through URL commands. The Kubernetes deployment uses a ambassador pod running NGINX to proxy the connection to a seperate Redis deployment for state persistence. The app can be deployed using the associated yaml definitions which use existing containers on the public dockerhub repository. Alternatively, the source is available to build from scratch and push the resulting containers to where ever you choose. The associated yaml configuration file specifies a service of type loadbalancer, if your Kubernetes deployment does not support a loadbalancer capability then adjust the yaml to change the service type to ingress.

If you choose to build from scratch then make sure the output binary is named main and it exists within the same directory as the Dockerfile. Use the following commands to build:

cd ambassador_src
CGO_ENABLED=0 GOOS=linux go build -a -o main .
docker build -t <your repo name>/ambassadorweb:<tag> .
docker push <your repo name>/ambassadorweb:<tag>
# update kubernetes yaml manifest to point container image to new repository
kubectl apply -f k8sconfigs/redis-dep.yaml
kubectl apply -f k8sconfigs/ambassador-svc-dep.yaml
kubectl get services -o wide # find the public address
browse to <address>:8080/setuser?id=1&greeting=hi&name=bob
browse to <address>:8080/getuser?id=1

Side Car App

The side car app is a simple go webserver which displays contents of a shared kubernetes volume. A side car container runs a bash script to populate a timestamp into a file within the share volume for the webserver to read and display for HTTP get requests. The associated yaml configuration file specifies a service of type loadbalancer, if your Kubernetes deployment does not support a loadbalancer capability then adjust the yaml to change the service type to ingress.

If you choose to build from scratch then make sure the output binary is named main and it exists within the same directory as the Dockerfile. Use the following commands to build:

cd sidecar_src
CGO_ENABLED=0 GOOS=linux go build -a -o main .
docker build -t <your repo name>/sidecarweb:<tag> .
docker push <your repo name>/sidecarweb:<tag>
cd sidecar
docker build -t <your repo name>/sidecar-sc:<tag> .
docker push <your repo name>/sidecar-sc:<tag>
# update kubernetes yaml manifest to point container image to new repository
kubectl apply -f k8sconfigs/sidecar-svc-dep.yaml
kubectl get services -o wide # find the public address
browse to <address>:8080/

ckad-study-apps's People

Contributors

james65535 avatar james65536 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.