Public Repository

Last pushed: 2 years ago
Short Description
Configuration graph generator for Kubernetes applications
Full Description

This is a Docker-ized version of the config-collector service for Kubernetes. This
service provides a REST endpoint (/config) through which clients can get a current
snapshot of the application's configuration graph (resources + inferred relations).

Instructions to deploy this service on GCP (Google Cloud Platform):

  1. Find the Kubernetes master and minion nodes:

    • Determine your Kubernetes project Id from the Google Developers Console.
    • Set the default project ID for the following gcloud commands with:
      gcloud config set project YOUR-KUBERNETES-PROJECT-ID.
    • Set the default zone for the following gcloud commands with:
      gcloud config set compute/zone ZONE-NAME.
    • List the name of GCE instances with the command:
      gcloud compute instances list.
    • The Kubernetes master will have the suffix "...-master" and the minion
      nodes will have the suffix "...-node-N".
  2. On each of the N minion nodes, enable the Docker REST API on port 4243:

    • SSH into the node: gcloud compute ssh KUBERNETES_MINION_NODE.
    • Edit /etc/default/docker with sudo vi /etc/default/docker
      (or another editor) and change the first line from DOCKER_OPTS=''
      to:
      DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'.
    • Restart the Docker service: sudo service docker restart.
    • Verify that Docker is running in this node by running the command:
      sudo docker ps
      
  3. Set up the config-collector service on the Kubernetes master:

    • SSH into the master: gcloud compute ssh KUBERNETES_MASTER.
    • Start the Docker service if it is NOT already running:
      sudo service docker start.
    • Download the config-collector Docker image from Docker Hub:
      sudo docker pull kubernetes/config-collector. Alternatively,
      if you want to build this Docker image from source, see instructions below.
    • Start the container:
      sudo docker run -d --net=host -p 5555:5555 --name config-collector kubernetes/config-collector
    • Check that you have the "config-collector" container running:
      sudo docker ps | grep config-collector
  4. Create a firewall rule to allow external HTTP traffic to the conf-collector
    service, which listens on port 5555 in
    the Kubernetes master. For example on GCP you can do this via:

    gcloud compute firewall-rules create "config-collector" --allow tcp:5555 --network "default" --source-ranges "0.0.0.0/0" --target-tags KUBERNETES_MASTER
    

    where KUBERNETES_MASTER is the Kubernetes master mode name
    (e.g. k8s-guestbook-master).

  5. Access the config-collector service from a browser to see the top-level help page:

    • Find the external IP address of the Kubernetes master by typing
      gcloud compute instances list
      and noting the EXTERNAL_IP for the KUBERNETES_MASTER instance.
    • From a browser go to the URL http://EXTERNAL_IP:5555. You should see
      a top level API help page.
    • This page will list all REST API targets supported by the
      data collector service. The most useful one is the /graph API, which returns
      a snapshot of the current configuration graph for the entire Kubernetes
      cluster.

How to build the config-collector Docker image from source:

  1. Download the source from GitHub: git clone https://github.com/.../config-collector.git

  2. cd into ./collector

  3. Build the Docker image within the /collector directory:
    sudo docker build -t kubernetes/config-collector . (don't forget the trailing ".")

  4. You should now have a local Docker image named kubernetes/config-collector: sudo docker images.

  5. Follow the instructions above on how to deploy the container in a Kubernetes cluster,
    skipping the step to "Download the config-collector Docker image from Docker Hub".

Docker Pull Command
Owner
vasbala

Comments (0)