Giter VIP home page Giter VIP logo

kubernetes_the_easy_way's Introduction

Kubernetes the easy way

This repository tries to automate the guide "Kubernetes The Hard Way" by Kelsey Hightower, using Vagrant and Virtualbox.

Prerequisites

  • Vagrant
  • VirtualBox 5.2
  • kubectl
  • cfssl
  • cfssljson

Documentation

Find my attempt at documenting this here Documentation

Installing cfssl and cfssljson

PKI and TLS Tools by Cloudflare (https://github.com/cloudflare/cfssl)

For Linux :
 curl -o /usr/local/bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
 curl -o /usr/local/bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64
 chmod +x /usr/local/bin/cfssl*

For Mac :
 curl -o /usr/local/bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_darwin-amd64
 curl -o /usr/local/bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_darwin-amd64
 chmod +x /usr/local/bin/cfssl*

For Windows :
  Download https://pkg.cfssl.org/R1.2/cfssl_windows-amd64.exe
  Download https://pkg.cfssl.org/R1.2/cfssljson_windows-amd64.exe
  Do whatever Windows people do

Getting started

First off, edit the file config. Here you can specify how many of each type of nodes you want. Eg. 3 master nodes. Also you can specify the number of CPU and Memory for each type.

Once thats done, just run ./install.sh.

What just happend

The script set the number of nodes you want and the resources they get. It then generates a hosts file with ip's and hostnames. This is used to configure each node in the cluster. Then it generates certificates, based on the hostfile.

Now it calls Vagrant to provition the nodes. While provitioning the nodes, Vagrant will copy scripts and certifiates to each node and execute them. The script can be found under the scripts folder and the certificates under the folder ssl.

Connect local kubectl to the new cluster

Set the current context to kubernets-the-easy-way

kubectl config use-context kubernetes-the-easy-way

Test connection and see worker nodes connected

kubectl get nodes

SSH into machines

Because we trick Vagrant into being dynamic in regards to number of machines, we need to set our variables before we can use Vagrant commands. So in order to use Vagrant commands, after the install.sh script has finished, run this

source config
vagrant ssh k8s-worker-1

Destroy machines

If Kubernetes is not your thing after all, or that you for other reasons want to remove the cluster, simply run this script

./destroy.sh

Important

Remember to run the destroy.sh script before running the install.sh script again.

kubernetes_the_easy_way's People

Contributors

hoeghh avatar randomsort 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  avatar

kubernetes_the_easy_way's Issues

Unable to connect to the server: x509: certificate signed by unknown authority

Getting below mentioned error message, please assist

Deploying KubeDNS...
Unable to connect to the server: x509: certificate signed by unknown authority ( possibly because of "crypto/rsa: verification error" while trying to verify cand idate authority certificate "Kubernetes")
Deploying WeaveNet...
Unable to connect to the server: x509: certificate signed by unknown authority ( possibly because of "crypto/rsa: verification error" while trying to verify cand idate authority certificate "Kubernetes")
./install.sh: line 45: ../logs/weavenet.log: No such file or directory

Regards,
Vikas

Accessibility of the cluster

Hi,

Eager to know that, if cluster is accessible/expose outside of the system like in the LAN,WAN and the internet.

Regards,Vikas

Pods are ContainerCreating state for long time

Pods are ContainerCreating state for long time, please advice

kubectl describe pods
Name: kubernetes-dashboard-64b6f585dd-mctwj
Namespace: default
Node: k8s-worker-2/192.168.50.32
Start Time: Fri, 02 Feb 2018 17:26:57 +0530
Labels: pod-template-hash=2062914188
run=kubernetes-dashboard
Annotations:
Status: Pending
IP:
Controlled By: ReplicaSet/kubernetes-dashboard-64b6f585dd
Containers:
kubernetes-dashboard:
Container ID:
Image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.8.2
Image ID:
Port: 8888/TCP
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-8nn45 (ro)
Conditions:
Type Status
Initialized True
Ready False
PodScheduled True
Volumes:
default-token-8nn45:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-8nn45
Optional: false
QoS Class: BestEffort
Node-Selectors:
Tolerations:
Events:
Type Reason Age From Message


Warning FailedCreatePodSandBox 59m kubelet, k8s-worker-2 Failed create pod sandbox.
Normal SuccessfulMountVolume 59m kubelet, k8s-worker-2 MountVolume.SetUp succeeded for volume "default-token-8nn45"
Normal SuccessfulMountVolume 59m kubelet, k8s-worker-2 MountVolume.SetUp succeeded for volume "default-token-8nn45"
Warning FailedCreatePodSandBox 59m kubelet, k8s-worker-2 Failed create pod sandbox.
Normal SuccessfulMountVolume 59m kubelet, k8s-worker-2 MountVolume.SetUp succeeded for volume "default-token-8nn45"
Warning FailedCreatePodSandBox 59m kubelet, k8s-worker-2 Failed create pod sandbox.

Internal_ip i etcd should be based host file

The var internal_ip in the install-etcd.sh is based on a grep on ifconfig. This is risky. The info is already in the generated host file. Grep ip from hosts via $(hostname).

error during File Provisiner

getting below error message

OS : ubuntu16.04.03-x64-desktop
virtualbox:virtualbox-5.2_5.2.6-120293Ubuntuxenial_amd64.deb
vagrant:vagrant_2.0.1_x86_64.deb

k8s-master-2: Installing master...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

File provisioner:

  • File upload source file /root/kubernetes_the_easy_way/output/k8s-worker-1.kubeconfig must exist
  • File upload source file /root/kubernetes_the_easy_way/output/kube-proxy.kubeconfig must exist

Implement api-severs

The script should install the API servers in accordance with kubernetes the hard way

Describe end goal in readme

In rhe readme, describe the end goal. What will I get when the script is done.

X x etcd, resources
X x api-seevers ..... And so on

unable to do ssh to the machine

Hi,

$vagrant ssh k8s-master-1
The machine with the name 'k8s-master-1' was not found configured for
this Vagrant environment.

unable to do ssh to the machine.

Regards,Vikas

Add load balancers to weave net network

The load balancer(s) are not connected to the pod network, so it/they can't serve any traffic at all. Lb is connected to the API server so it does configure itself with all frot and backends.

We need to manually install weave net on load balancer(s). Before that, nothing will be served by ingress.

Generate certificates, or use provided to traefik

Right now we have the following in the traefik.toml file

#CertFile = "/root/ssl/traefik-wildcard.pem"
#KeyFile = "/root/ssl/traefik-wildcard.key"

We need to create these certificates, and put them in use

How to make use of own docker registry

Hi,

How to make use of own private docker registry or export/import of docker image for deployment. Is it possible for both the methods.

Regards,Vikas

Create floating ip on masters

Use corosync and pacemaker to create a floating ip between all master nodes. This will then be the external IP for master nodes.

Describe how to add another worker

Once the cluster is provisioned, one might want to add yet another worker node. We should have a guide and some scripts for doing this.

Add log output to file

Certificates generation and vagrant output shout be directed to a file in a log directory.

Eg.
vagrant up --debug &> logs/vagrant_$(date)_log

no route to host

Hi,

Getting below message, firewall is disabled in host machine

docker@node2:~/kubernetes_the_easy_way$ kubectl get nodes
Unable to connect to the server: dial tcp 192.168.50.20:6443: getsockopt: no route to host

Regards,Vikas

Simplify install scripts with an install config

Right now each host needs to look into a host file and do a lot of jumps to configure itself.

I think it would be smart to generate an install config file that is copied to each host, and used by the install script.

It will make it easier to add more nodes, as it is only to generate a config and then run the same script as the others

It will also make it easier later, to use the scripts outside of this project, or with a provitioning master.

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.