Giter Club home page Giter Club logo

k8s's Introduction

Utilizando K8S

This challenge is split in three parts. All solutions are based on kubernetes.

1.NGINX Web Server

Follow the below steps to accomplish the first part of the challenge:

  • Use the Nginx Alpine base image;
  • Make three replicas available;
  • When someone accesses the LoadBalance extern IP of the created service, it should be displayed in the browser: Code.education Rocks.

2.MYSQL Configuration

To accomplish this part of the challenge, the following steps are needed:

  • Configure a MySQL database server using the kubernetes concept of deployment;
  • Use secret along with the environment variable;
  • Use persistent volume claim to store the data that come from MySQL.

3.Go Challenge

The steps to accomplish this challenge are:

  • Create a Golang app that starts a web server on port 8000. When the server is accessed a message(in bold) saying Code.education Rocks! should be displayed. The responsible for formatting the message is a function named greeting that receives a string as parameter and returns it between the HTML bold tags(<b></b>);
  • Create a unit test for the greeting function;
  • Start a CI process on Google Cloud Build platform to make sure that each created Pull Request triggers the unit test;
  • Build an optmized image of the Golang app and push it to DokcerHub;
  • Using Kubernetes, start a LoadBalancer service that allows to access the Go application running in the cluster.

Note: The Go project image can be pulled from here.

Goal

The goals of this challenge is to learn kubernetes' concepets and how it works in practice.

Usage

In order to be able to run this challenge you must have minikube and kubectl installed previously.

1.NGINX Web Server

Start the cluster:

$ minikube start

Create the objects and run the service:

$ cd nginx/
$ kubectl apply -f configmap.yaml
$ kubectl apply -f deployment.yaml
$ kubectl apply -f service.yaml

See the objects' status:

$ kubectl get configmap
$ kubectl get deployment
$ kubectl get service

Access the service:

$ minikube service nginx-k8s-service

To delete all the objects and stop the cluster:

$ kubectl delete configmap nginx-html
$ kubectl delete deployment nginx-k8s
$ kubectl delete service nginx-k8s-service
$ minikube stop

2.MYSQL Configuration

Start the cluster:

$ minikube start

Create the objects and run the service:

$ cd mysql/
$ kubectl apply -f persistent-volume.yaml
$ kubectl apply -f deployment.yaml
$ kubectl apply -f service.yaml

See the objects' status:

$ kubectl get persistentvolumeclaim
$ kubectl get deployment
$ kubectl get service

To delete all the objects and stop the cluster:

$ kubectl delete persistentvolumeclaim mysql-pv-claim
$ kubectl delete deployment mysql-server
$ kubectl delete service mysql-service
$ minikube stop

3.Go Challenge

Start the cluster:

$ minikube start

Create the objects and run the service:

$ cd go/k8s/
$ kubectl apply -f deployment.yaml
$ kubectl apply -f service.yaml

See the objects' status:

$ kubectl get deployment
$ kubectl get service

Access the service:

$ minikube service go-service

To delete all the objects and stop the cluster:

$ kubectl delete deployment go-server
$ kubectl delete service go-service
$ minikube stop

k8s's People

Contributors

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