GithubHelp home page GithubHelp logo

kubernetes-do's Introduction

Guide to creating a Kubernetes cluster on a coreos instance on Digital Ocean with three nodes.

Creating coreos cluster on Digital Ocean

  1. Create a node with the following configuration
  • 1GB/1CPU 30GB 2TB nodehttps://discovery.etcd.io/new?size=3
  • Select an appropriate region
  • CoreOS 76.4.0(Stable release)
  • Turn on private networking
  • Select User Data option
  • In the textbox for user data provide information as specidied in this file
    • Use this URL https://discovery.etcd.io/new?size=3 to generate a discovery token. The 3 at the end of the token specifies the number of nodes that are to be present while initiating the cluster. A minimum of these many number of nodes should be present in the cluster for it to be connected through fleet.
    • Replace the token generated above in line 7 of the cloud-config file.
  • CoreOS instances can only be connected to via ssh and hence a public-key needs to be set up in the digital ocean dashboard. Use this link to learn how to setup ssh keys with digital ocean.
  • In a similar manner create 2 more nodes.
  1. Once the nodes are created you can securely connect to them using ssh. ssh -A core@public-ip-address
  2. Once you are connected to the device you can clone this repository
    git clone https://github.com/jiteshmohan/kubernetes-do.git
  3. Create a new directory /opt/bin/
    sudo mkdir -p /opt/bin/
  4. cd kubernetes-do
  5. Copy all files from the folder executables into the /opt/bin/ directory.
    sudo cp executables/* /opt/bin/
  6. Next you need to copy the service files to /etc/systemd/system/. However the files are separate for master and minion.
  • On the master: sudo cp service-files/master/*.service /etc/systemd/system/
  • On minion: sudo cp service-files/minion/*.service /etc/systemd/system/
  1. Digital ocean creates a file /etc/environment when spawning the instance. The contents of this file are as follows:
    $ cat /etc/environment
    COREOS_PRIVATE_IPV4=<ip_addr>
    COREOS_PUBLIC_IPV4=<ip_addr>
    
    To this file add additional two lines in the case of the minion. The lines that need to be added are
    MASTER_PUBLIC_IPV4=<ip_addr>
    MASTER_PRIVATE_IPV4=<ip_addr>
    
  2. Ensure that all the executable copied into /opt/bin have execute permissions.
  3. Enable the services that we created.
    cd /etc/systemd/system
    sudo systemctl enable *
    
  4. On master start the following services
    sudo systemctl restart flanneld
    sudo systemctl restart docker
    sudo systemctl restart kube-apiserver
    sudo systemctl restart kube-controller-manager
    sudo systemctl restart kube-scheduler
    sudo systemctl restart kube-proxy
    sudo systemctl restart kubelet
  5. On the minions start the following services
    sudo systemctl restart flanneld
    sudo systemctl restart docker
    sudo systemctl restart kube-scheduler
    sudo systemctl restart kube-proxy
    sudo systemctl restart kubelet
  6. After starting all the above services use
    systemctl status <service-name>
    to check the status of each service.
  7. On the master run the following command to get the list of machines in the kubernetes cluster.
    kubectl get nodes
  8. To access the Kubernetes dashboard perform the following steps
    cd
    git clone https://github.com/kubernetes/kubernetes.git
    cd kubernetes
    kubectl create -f cluster/addons/kube-ui/kube-ui-rc.yaml --namespace=kube-system
    kubectl create -f cluster/addons/kube-ui/kube-ui-svc.yaml --namespace=kube-system
  9. To access the UI use the link https://<master-public-ip>:6443/ui/

Screencast

Screencast

References

kubernetes-do's People

Contributors

jiteshmohan avatar

Watchers

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