Giter Club home page Giter Club logo

kubernetes-elastic-stack's Introduction

CircleCI

Logging with Elastic in Kubernetes

See docs for full recipe content.

This setup is similar to the Full Stack Example, but adopted to be run on a Kubernetes cluster.

There is no access control for the Kibana web interface. If you want to run this in public you need to secure your setup. The provided manifests here are for demonstration purposes only.

Local Setup

Start a local Kubernetes using minikube

If some webpages don't show up immediately wait a bit and reload. Also the Kubernetes Dashboard needs reloading to update its view.

minikube start --memory 4096

minikube dashboard
# maybe wait a bit and retry
kubectl get --all-namespaces services,pods

Logging with Elasticsearch and fluentd

kubectl apply \
  --filename https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml

minikube service kibana

For the index pattern in Kibana choose fluentd-*, then switch to the "Discover" view. Every log line by containers running within the Kubernetes cluster is enhanced by meta data like namespace_name, labels and so on. This way it is easy to group and filter down on specific parts.

Turn down all logging components

kubectl delete \
  --filename https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml

FIXME alternatively --selector stack=logging

To delete the whole local Kubernetes cluster use this:

minikube delete

kubernetes-elastic-stack's People

Contributors

marians avatar paurosello avatar pipo02mix avatar puja108 avatar t-kukawka avatar webwurst avatar

Stargazers

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

Watchers

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

kubernetes-elastic-stack's Issues

kubectl apply does not work

I tried these steps on minikube :

minikube start --memory 4096
kubectl apply   --filename https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml

Error from server (BadRequest): error when creating "https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml": Role in version "v1" cannot be handled as a Role: no kind "Role" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error when creating "https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml": RoleBinding in version "v1" cannot be handled as a RoleBinding: no kind "RoleBinding" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error when creating "https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml": ClusterRole in version "v1" cannot be handled as a ClusterRole: no kind "ClusterRole" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error when creating "https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml": ClusterRoleBinding in version "v1" cannot be handled as a ClusterRoleBinding: no kind "ClusterRoleBinding" is registered for version "rbac.authorization.k8s.io/v1"

elasticsearch Pod on pending state

> kubectl get pod
NAME                             READY     STATUS    RESTARTS   AGE
elasticsearch-664c95c75c-sfrpq   0/1       Pending   0          23s
fluentd-nw4zk                    1/1       Running   0          3m
kibana-787db9b7fb-w2gcd          1/1       Running   0          3m
oauth2-proxy-55b5d84b99-z7799    1/1       Running   0          3m
> kubectl describe pod elasticsearch-664c95c75c-sfrpq
...
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      elasticsearch
    Optional:  false
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  elasticsearch
    ReadOnly:   false
  elasticsearch-token-6w6dx:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  elasticsearch-token-6w6dx
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     <none>
Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  14s (x15 over 3m)  default-scheduler  PersistentVolumeClaim is not bound: "elasticsearch"

fluentd status is CrashLoopBackOff

Got below error:

sed: can't create temp file '/fluentd/etc/fluent.confXXXXXX': Read-only file system

Seems the reasone is the the below volume config is configMap:

        volumeMounts:
        - name: config
          mountPath: /fluentd/etc

And in the latest kubernetes version (1.10.0, or 1.9.*?), configMap is mounted readonly which means /fluentd/etc is readonly. However, the fluentd's entrypoint.sh would write the config that causes the error.

See this issue in fluentd.
fluent/fluentd-kubernetes-daemonset#90

Evaluate fluentd for log shipping

Maybe only as an alternative. Would be good to also have the fluentd option not only because it's CNCF, but also cause people might want to ship logs to other datastores that are better supported by fluentd.

An example DS can be found here:
https://github.com/inovex/kubernetes-logging
and
http://logz.io/blog/kubernetes-log-analysis/

Tasks:

  • Create Fluentd Docker image
  • Create Kubernetes manifests
  • Document configuration settings
  • Document special config for Minikube

Error "the API version in the data (batch/v2alpha1) does not match the expected API version (batch/v1beta1)"

The Yaml validation fails.
error: error validating "https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml": error validating data: the server could not find the requested resource; if you choose to ignore these errors, turn validation off with --validate=false

Error from server (BadRequest): error when creating "https://raw.githubusercontent.com/giantswarm/kubernetes-elastic-stack/master/manifests-all.yaml": the API version in the data (batch/v2alpha1) does not match the expected API version (batch/v1beta1)

I'm running Kubernetes 1.8.0

Install into kube-system namespace?

Currently, manifests-all.yaml requires the parameter --namespace=default. It is desirable though to be able to deploy into some other namespace, e.g. kube-system, to keep default less populated.

Security configuration

Hello,

Thank you for the script! It seems that as of right now the deployed kibana is open for anyone to see, how would you go about securing the access ?

Thanks,
Max

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.