Giter Site home page Giter Site logo

sumitmaji / kubernetes Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 27.0 7.61 MB

Scripts to create cluster and install kubernetes cluster.

Shell 83.60% Dockerfile 5.60% Mustache 3.04% JavaScript 2.52% Python 5.25%
docker kubernetes-setup etcd devops k8s kubernetes kubernetes-cluster kubernetes-deployment authentication ingress-nginx

kubernetes's Introduction

kubernetes

Installation of kubernetes cluster in private cloud using kubeadm.

Configuration

The following table lists the configurable parameters of the kubernetes cluster install and their default values.

Parameter Description Default
CLUSTER_NAME Kubernetes cluster name cloud.com
MOUNT_PATH The mount path where kubernetes scripts and certificates are available. /root
DNS_DOMAIN The domains where vms are hosted. cloud.uat
CERTIFICATE_PATH The path where certificates are present. /etc/kubernetes/pki
SERVER_DNS The comma separated dns names where kubernetes master would be running, this also includes name of the kubernetes api service dns names, the dns name where ha proxy is running master.cloud.com..
SERVER_IP The comma separated list of all the ip addresses where master and ha proxy would be running (actual & virtual). This should also include the ip addess of kubernetes cluster api service ip. 11.0.0.1,..
HA_PROXY_PORT Port of HA Proxy. 6443
HA_PROXY_HOSTNAME IP/Hostname where HA Proxy running. 11.0.0.1
LOAD_BALANCER_URL Endpoint of HA Proxy. 11.0.0.1:6443
APP_HOST Hostname that would be put in ingress. master.cloud.com
API_SERVERS List of api servers which are used in creating certificates for ha proxy. 11.0.0.1:master.clud.com,..
OIDC_ISSUE_URL OpenID Connect issuer url. https://skmaji.auth0.com/
OIDC_CLIENT_ID OpenID Connect Application ID. Client ID
OIDC_USERNAME_CLAIM Field name in the ID Token for username claim. sub
OIDC_GROUPS_CLAIM Field name in the ID Token for group claim. http://localhost:8080/claims/groups

Installation steps:

  • Install Cluster in Digital Ocean
cd /root/kubernetes/install_cluster
./install_master_node.sh -e CLOUD
  • Install Cluster in Local Ubuntu Cluster
cd /root/kubernetes/install_cluster
./install_master_node.sh -e LOCAL
  • Install kubernetes:

    • Master:
    cd /root/kubernetes/install_k8s
    ./gok install kubernetes
    • Worker:
    cd /root/kubernetes/install_k8s
    ./gok install kubernetes-worker
    • To join a worker node:
    join
    • To remove a kubernetes setup:
    ./gok reset kubernetes
    • To create a new join token
    kubeadm token create print-join-command

When installation of master is completed you should see below components in kube-system namespace alt text

When you reboot the vms, the kubelet service may not run, you need to restart the kubelet.

sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
sudo swapoff -a

systemctl stop kubelet
syatemctl start kubelet

Or Execute below command

./gok start proxy

Other debugging steps

systemctl status kubelet
journalctl -u kubelet

Useful commands:

  • To change namespace
kcd name_space
  • Inorder to login via OpenId Connect username/password
alias kctl='kubectl --kubeconfig=/root/oauth.conf --token=$(python3 /root/kubernetes/install_k8s/kube-login/cli-auth.py)'

In order to use the above approach, you must install and run

  1. Ingress Instress ReadME
  2. Kubeauthentication service KubeAuth ReadME
  • To enable verbose(logging) of kubectl command
kubectl get pods --v 6

Useful commands

kubectl top nodes --v 6
kubectl get pod, svc, hpa -owide
watch -n1 !!
kubectl get componentstatus

Automation of build and deployment

Note: Ingress should be installed before this can begin.

  • Execute below command to install ci/cd pipeline
cd /root/kubernetes/install_k8s/
./setuUp-devops.sh 

This would install local docker registry, Git webhook, Docker webhook and Helm webhook

Architecture of the pipeline alt text

In order to test the pipeline use hlw repository, make a sample change and commit.

Application would be accessible in https://master.cloud.com:32028/hlw

Installing components

  1. Ingress Controller
  2. Cert Manager
  3. Keycloak
  4. Kube Login Webhook
  5. Devops: Githook, Dockerhook,Reghook
  6. Kubernetes Dashboard
  7. Kube Authentication
  8. Ldap: Link
  9. Kerberos: Link
  10. Ldap Client: Link
  11. Ldap Client2: Link
  12. Spinnaer
  13. Opensearch
  14. Prometheus-Grafana
  15. Oauth2 Proxy
  16. Fluentd
  • Add ca.crt and server.crt file in chrome browser, please refer link on how to add certificate. Add server.crt in Other People tab and ca.crt in Trusted Root Certificate Authority tab.
  • Add ip_address master.cloud.com to windows host file located in C:\Windows\System32\drivers\etc. e.g. 192.168.1.5 master.cloud.com >> host file.

kubernetes's People

Contributors

sumitmaji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kubernetes's Issues

Convert the script into a Ritchie CLI formula

Hi @sumitmaji , what a great repository, well done ! ๐Ÿฅ‡

I would like to discuss about Ritchie CLI and how your script could executed another way, based on your current implementation.

It's an open source product our team has created and that allows to transform scripts into formulas (in our context, formulas are automations that can be executed through command line, locally or with Docker, with necessary dependencies).

Your script is very powerful and we would love to have it as a formula to show the community a use case of our product with clusters and kubernetes.

Would you like to take a look at our documentation (link above) and give us a feedback about the tool ?

You could create your own formulas repository to share it, or add it to our commons formulas repository.

If you wish, we can also do it together to take the opportunity to discuss about the product.

Regards,

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.