Giter Site home page Giter Site logo

lekhanhtech / kubernetes Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 364 KB

This project give you a collection of tools to create/delete Kubernetes Cluster on Ubuntu.

Home Page: https://www.youtube.com/channel/UCFM3plFG0QUavW1FPfize7g/playlists

Shell 92.50% Python 7.50%
kubernetes kubernetes-cluster kubernetes-deployment container containerization virtualized selenium automation automation-test cicd

kubernetes's Introduction

Kubernetes on Unbuntu

This project give you a collection of tools to create/delete Kubernetes Cluster on Ubuntu.

1. Prerequisites

Make sure you have installed/config these tools before going to futher steps:

2. Clean the old cluster

Run the command ./delete-cluster.sh

3. Create new cluster

3.1. Init cluster

3.2. Join worker node

kubeadm join --cri-socket /run/containerd/containerd.sock --token <token> <control-plane-host>:<control-plane-port> --discovery-token-ca-cert-hash sha256:<hash>

4. Deploy new services

4.1. Deploy service

  • Create new deployment file (.yaml file)
  • Apply the deployment file (call the command kubectl apply -f <deployment file> or use Dashboard to deploy)
  • Expose your service:
    • Create a .yaml file for your Ingress resouce to expose your service. Look at the Ingress in ./dashboard/kubernetes-dashboard.yaml for an example.
    • Deploy it via kubectl apply -f or Dashboard

4.2. Mapping domain

  • Assume you own the domain example.org, and already point all the subdomain *.example.org to our you office. Also, assume you have an Nginx proxy server. If you want to point one of the sub domain to your service, let follow these steps:
    • Double check which ports are being used by the Nginx Ingress service on your cluser: Nginx ingress
    • SSH to the proxy server:
      • Create a new config file in /etc/nginx/sites-availble, forward the request ro your Nginx Ingress Controler on your master node (You can put the example file in /etc/nginx/sites-availble/dashboard.k8s-cluster.example.org.conf, then change the domain name, ports, and ssl config).
      • Link the new config file to /etc/nginx/sites-enable
      • Make sure you have included this line in the section http of /etc/nginx/nginx.conf
        include /etc/nginx/sites-enabled/*;
        
      • Test the new config:
        sudo nginx -t
        
      • If everything are OK, reload the nginx:
        sudo nginx -s reload
        

5. Example

We will demonstrate how to deploy services on Kubernetes by Deploy Selenium Grid for Automation Test.

Note: We split the .yaml files to explain step by step, you can merge all the yaml file in this example in to one, and deploy them once. We use command line to deploy the services, but you can also use the Dashboard instead of.

5. 1. Deploy the services

kubectl apply -f ./example/selenium/full-grid.yaml

5.2. Auto scalling (optional)

kubectl apply -f ./example/selenium/nodes-autoscale.yaml

5.2. Expose the service

kubectl apply -f ./example/selenium/ingress.yaml

5.4 Mapping domain

  • SSH to the proxy server (192.168.3.37)
  • Create the config file at /etc/nginx/sites-available/selenium.example.org.conf. Make sure to update the host, port, and proxy_pass according to your Kubernetes and Ingress Controller.
  • Then link it to /etc/nginx/sites-enable/
cd /etc/nginx/sites-enable/
sudo ln -s ../sites-available/selenium.example.org.conf
  • Check if there are any errors
sudo nginx -t
  • Reload the proxy
sudo nginx -s reload

5.5. Double check

If everything work well, access http://selenium.example.org, you should see something look like this: Nginx ingress

6. Remain issues

We already install Cert-Manager to generate certificates automatically (using Letsencrypt).

But there is an issue with forwarding https request to the our Kubernetes, it make the proxy server and the order hang out. We need someone continue the work, follow these guideline to troubleshoote:

Reference

kubernetes's People

Contributors

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