• This repository has been archived on 24/Oct/2023
  • Stars
    star
    1,178
  • Rank 38,325 (Top 0.8 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kubediff: a tool for Kubernetes to show differences between running state and version controlled configuration.

Kubediff

Kubediff is a tool for Kubernetes to show you the differences between your running configuration and your version controlled configuration.

Kubediff can be run from the command line:

$ ./kubediff
usage: kubediff [-h] [--kubeconfig KUBECONFIG] [--context CONTEXT] [--namespace NAMESPACE] [--json] [--no-error-on-diff] [paths ...]

     _          _             _  _   __   __
    | |__ _  _ | |__  ___  __| |(_) / _| / _|
    | / /| || || '_ \/ -_)/ _` || ||  _||  _|
    |_\_\ \_,_||_.__/\___|\__,_||_||_|  |_|

    Compare yaml files in path(s) to running state in kubernetes and print the
    differences. This is useful to ensure you have applied all your changes
    to the appropriate environment. This tools runs kubectl, so unless your
    ~/.kube/config is configured for the correct environment, you will need
    to supply the kubeconfig for the appropriate environment.

positional arguments:
  paths                  path(s) from which kubediff will look for configuration files

optional arguments:
  -h, --help            show this help message and exit
  --kubeconfig KUBECONFIG, -k KUBECONFIG
                        path to kubeconfig
  --context CONTEXT, -c CONTEXT
                        name of kubeconfig context to use
  --namespace NAMESPACE, -n NAMESPACE
                        Namespace to assume for objects where it is not specified (default = Kubernetes default for current context)
  --json, -j            output in json format
  --no-error-on-diff, -e
                        don't exit with 2 if diff exists

For example:

$ ./kubediff k8s
Checking ReplicationController 'kubediff'
 *** .spec.template.spec.containers[0].args[0]: '-repo=https://github.com/weaveworks/kubediff' != '-repo=https://github.com/<your github repo>'
Checking Secret 'kubediff-secret'
Checking Service 'kubediff'

Make sure the dependencies are installed first:

$ pip install -r requirements.txt

Kubediff can also be run as a service on Kubernetes, periodically downloading the latest configuration from Github, comparing it to the running configuration. In this mode Kubediff will also offers a very simple UI showing the output and export the result to Prometheus, all courtesy to prom-run.

To deploy to Kubernetes, you much first make a copy of the YAML files in k8s and update the following fields:

  • kubediff-rc.yaml the first argument to git-sync must be the location of the config repo, and the last argument to kubediff must the the location in this repo of your config.
  • kubediff-secret.yaml the username and password must be set to valid github OAuth token.

Once you have updated the config, the following commands should bring up the service:

$ kubectl create -f k8s
replicationcontroller "kubediff" created
secret "kubediff-secret" created
service "kubediff" created

And to view the UI, run the follow command and go to http://localhost:4040

`$ kubectl port-forward $(kubectl get pod --selector=name=kubediff -o jsonpath={.items..metadata.name}) 4040:80`

Kubediff Screenshot

This service exports the exit code of the kubediff as a Prometheus metric; a suitable alert can be setup for persistent differences:

ALERT Kubediff
  IF          max(command_exit_code{job="kubediff"}) != 0
  FOR         2h
  LABELS      { severity="warning" }
  ANNOTATIONS {
    summary = "Kubediff has detected a difference in running config.",
    description = "Kubediff has detected a difference in running config.",
  }

These alerts can be sent to Slack, for example:

Slack Alert

compare-images

To quickly see how two sets of configurations differ, purely in terms of images:

$ ./compare-images ../service-conf/k8s/dev/ ../service-conf/k8s/prod/
Image                          dev                   prod
-----------------------------  --------------------  --------------------
quay.io/weaveworks/grafana     master-0fc7cc2        master-08fd09d
quay.io/weaveworks/prometheus  master-0fc7cc2        master-4fb2aed
quay.io/weaveworks/ui-server   master-2899c36        master-45d67b3
tomwilkie/prometheus           frankenstein-8a5ec1b  frankenstein-ebe5808
weaveworks/scope               master-1a1021c        master-14d0e4e

Build

mkdir -p $GOPATH/src/github.com/prometheus && cd "$_"
git clone [email protected]:prometheus/client_golang.git
mkdir -p $GOPATH/src/github.com/weaveworks && cd "$_"
git clone [email protected]:weaveworks/kubediff.git
cd kubediff
make

Getting Help

If you have any questions about, feedback for or problems with kubediff:

Weaveworks follows the CNCF Code of Conduct. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a Weaveworks project maintainer, or Alexis Richardson ([email protected]).

Your feedback is always welcome!

More Repositories

1

weave

Simple, resilient multi-host containers networking and more.
Go
6,577
star
2

scope

Monitoring, visualisation & management for Docker & Kubernetes
Go
5,817
star
3

eksctl

The official CLI for Amazon EKS
Go
4,493
star
4

ignite

Ignite a Firecracker microVM
Go
3,475
star
5

grafanalib

Python library for building Grafana dashboards
Python
1,824
star
6

footloose

Container Machines - Containers that look like Virtual Machines
Go
1,586
star
7

awesome-gitops

A curated list for awesome GitOps resources
1,396
star
8

tf-controller

A GitOps Terraform controller for Kubernetes
Go
1,002
star
9

mesh

A tool for building distributed applications.
Go
867
star
10

weave-gitops

Weave GitOps provides insights into your application deployments, and makes continuous delivery with GitOps easier to adopt and scale across your teams.
MDX
853
star
11

tcptracer-bpf

eBPF program using kprobes to trace TCP events without run-time compilation dependencies
Shell
401
star
12

wksctl

Open Source Weaveworks Kubernetes System
Go
398
star
13

wks-quickstart-firekube

Example configuration to create Kubernetes clusters powered by ignite and gitops
Shell
343
star
14

prom-aggregation-gateway

An aggregating push gateway for Prometheus
Shell
328
star
15

vscode-gitops-tools

GitOps Visual Studio Code Extension
TypeScript
216
star
16

promjs

TypeScript
150
star
17

weave-gitops-enterprise

This repo provides the enterprise level features for the weave-gitops product, including CAPI cluster creation and team workspaces.
Go
149
star
18

common

Libraries used in multiple Weave projects
Go
128
star
19

go-odp

A Go library to control the Open vSwitch in-kernel datapath
Go
71
star
20

libgitops

A Go library for implementing GitOps, used by Ignite
Go
65
star
21

terraform-kubernetes

Terraform module for provisioning AWS resources to run a Kubernetes cluster
HCL
61
star
22

eks-quickstart-app-dev

Example flux manifests for eksctl gitops
56
star
23

build-tools

Collection of build & test tools shared by various Weaveworks projects
Shell
45
star
24

cluster-api-provider-existinginfra

Manage existing infrastructure with Cluster API using this provider.
Go
45
star
25

flintlock

Lock, Stock, and Two Smoking MicroVMs. Create and manage the lifecycle of MicroVMs backed by containerd.
Go
41
star
26

kubernetes-ami

A simple AMI and CloudFormation for launching Kubernetes on AWS
Shell
41
star
27

promrus

Logrus hook to expose Prometheus metrics.
Go
34
star
28

policy-agent

Weaveworks Policy Agent
Go
31
star
29

ui-components

A collection of UI components that are shared across Weaveworks projects
JavaScript
30
star
30

weaveworks-backstage

Backstage app and Plugins for WeaveWorks and Flux.
TypeScript
29
star
31

integrations

Weave Third-Party Integrations
Shell
26
star
32

prometheus_sql_exporter

A service that exposes user-specified SQL queries on a prometheus metrics endpoint
Go
25
star
33

cortex-dashboards

Grafana dashboards for Cortex
Python
22
star
34

guestbook-gitops

GitOps with GitHub Actions to ECR and EKS
Makefile
19
star
35

fk-covid

Firekube distro with COVID-Net ML
Shell
18
star
36

multienv-example

Example of how to manage configuration for multiple Kubernetes clusters e.g., dev, staging, production
14
star
37

profiles

GitOps native package management
Go
11
star
38

mlops-profile

Kubeflow-based Machine Learning Profile
10
star
39

launcher

Weave Cloud Launcher
Go
10
star
40

eks-appmesh-profile

AWS App Mesh eksctl profile
10
star
41

docker-ansible

Shell
9
star
42

homebrew-tap

Ruby
9
star
43

weavecloud-browser-extension

Browser extension to integrate Grafana dashboards with Weave Cloud
JavaScript
9
star
44

billing-client

A client library for sending usage data to the billing system.
Go
7
star
45

pctl

CLI for interacting with profiles
Go
7
star
46

flux-example

Small example of Kubernetes config, for the purpose of illustrating how to use Flux
Go
7
star
47

wordepress

Tool support enabling hosting of technical documentation in WordPress
Go
7
star
48

MoodyKubie

Face detection and emotion classification, in Docker containers, on Kubernetes, running on CubieBoard (ARM).
JavaScript
7
star
49

flux-adapter

Connecting fluxd to Weave Cloud
Go
6
star
50

image-builder

Image building for Weaveworks projects.
Dockerfile
6
star
51

gitopssets-controller

Manages the GitOpsSet CRDs.
Go
6
star
52

covid-ml-profile

FireKube and EKS Machine Learning Profile for the fk-covid Project
5
star
53

cluster-controller

cluster-controller for Weave GitOps Enterprise
Go
5
star
54

profiles-catalog

Profiles for Weave GitOps
Makefile
5
star
55

alertdiff

Expose metrics detailing differences between two alert sources
Haskell
4
star
56

flux2-openshift

OperatorHub submission repo for Flux2
JavaScript
4
star
57

weave-gitops-quickstart

Quickstart resources to get you started with Weave GitOps Enterprise
4
star
58

cluster-bootstrap-controller

bootstrap-controller for Weave Gitops Enterprise
Go
4
star
59

gitops-toolkit-demo

GoTK Demo
3
star
60

schemer

Library to generate JSON schemas for your docs
Go
3
star
61

weave-gitops-scenarios

Various test scenarios for weave-gitops
Python
3
star
62

wkp-docs

Home of the Weave Kubernetes Platform technical documentation.
JavaScript
3
star
63

cluster-api-provider-firecracker

CAPF - A Cluster API Provider for Firecracker
2
star
64

weave-gitops-profile-examples

These profiles and profile index can be used as examples of how to construct a Weave GitOps Enterprise profile and repository.
Smarty
2
star
65

backstage-sockshop

Sockshop Components for Backstage
2
star
66

service

☁️ Images for Weave Cloud (R) (TM) (C) ☁️
Go
2
star
67

policy-library

The policy-as-code library
Open Policy Agent
2
star
68

clusters-config

Configuration for engineering's ephemeral clusters
Shell
2
star
69

buildpack-profile

1
star
70

weave-gitops-ssp-addon

Weave GitOps AddOn for SSP EKS Quickstart
TypeScript
1
star
71

weave-assured-flux

Weaveworks Assured Flux
Shell
1
star
72

go-git-providers

A collection of clients for different git providers like Github
Go
1
star
73

weave-action

Weaveworks GitHub Actions
1
star
74

homebrew-weave-gitops

The repository contains only the brew formula for installing weave-gitops
Ruby
1
star
75

templates-controller

Manages the GitopsTemplates CRDs
Go
1
star
76

flux-shard-controller

Easily spread load across replicated kustomize, source, helm and notification controllers
Go
1
star
77

cluster-reflector-controller

Automatically "reflect" existing AKS/EKS/GKE clusters into Weave GitOps Enterprise.
Go
1
star
78

corp-gh-org-controller

A Kubernetes controller to create and manage GitHub Enterprise Organisations.
Go
1
star
79

microvm-scheduler-api

The API types for the Microvm Scheduler
1
star
80

pipeline-controller

This repository contains the Pipeline CRD and associated controller for Weave GitOps Enterprise.
Go
1
star
81

weave-gitops-private

This is for tracking weaveworks internal information on weave-gitops. Will include issues, internal roadmaps, etc.
Shell
1
star
82

weaveworks-backstage-enterprise

Weaveworks enterprise backstage plugins
TypeScript
1
star
83

progressive-delivery

This repository contains the progressive delivery API handlers that Weave GitOps Enterprise serves.
Go
1
star
84

weave-gitops-clusters

Configuration for the staging k8s clusters used by weave-gitops.
HCL
1
star
85

weave-policy-validator

Weaveworks Infrastructure as Code Validator
Go
1
star
86

sa-demos

This repository is dealing with the Weave GitOps demos and demo environments. Please use it to file and update issues that you are seeing. You can also put your demo guides and demo scripts here.
Shell
1
star