GithubHelp home page GithubHelp logo

elk-cluster's Introduction

ELK example

Code to create an ELK (Elasticsearch, Logstash, Kibana) stack that allows a user to search by IP and Status code in nginx access logs.

Create k8s cluster

Export var for token:

export K8STOKEN=$(python -c 'import random; print "%0x.%0x" % (random.SystemRandom().getrandbits(3*8), random.SystemRandom().getrandbits(8*8))')

Generate ssh key:

ssh-keygen -f k8s-test

Run plan and then apply with terraform:

terraform plan -var k8stoken="$K8STOKEN" -var k8s-ssh-key="$(cat k8s-test.pub)"

After apply you should see output with the DNS names of kubernetes master and ELB for nginx cluster:

Outputs:

elb_dns = terraform-nginx-elb-1867464652.us-east-1.elb.amazonaws.com
master_dns = ec2-54-209-90-109.compute-1.amazonaws.com

Login with the key created above, you should see kubernetes cluster running: (may take few min to download all docker images)

$ ssh ubuntu@$(terraform output master_dns) -i k8s-test

ubuntu@ip-10-200-2-196:~$ kubectl cluster-info

Kubernetes master is running at http://localhost:8080

Kibana/ES

After terraform run is completed and k8s setup runs through all steps, kibana and k8s dashboards become available at the master DNS.

MASTER_DNS=$(terraform output master_dns)
echo $MASTER_DNS

Open in browser:
Dashboard: http://$MASTER_DNS/k8s-jf2js8/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard/#/workload?namespace=default
Kibana: http://$MASTER_DNS/k8s-jf2js8/api/v1/proxy/namespaces/kube-system/services/kibana-logging/#/settings/indices/?_g=()

TODO

Make nginx cluster to send logs to ES

Create ES/Kibana as standalone services, not as k8s addons

Security and authentication for k8s dashboard

Access to Kibana via ELB

elk-cluster's People

Contributors

rokka-n avatar

Stargazers

Berenice Cotero 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.