Giter Site home page Giter Site logo

kubeproxy-ext's Introduction

kube-proxy extension

It injects additional information to Pods of the response (kubectl columns). This container is a reverse proxy to a Kubernetes API provided by kube-proxy (without authentication).

Supported compressions

It decompresses gzip and deflate content encodings.

Supported fields

Below fields are supported on Pods (same to the columns of kubectl get pod -o wide):

  • NAME Name
  • READY Ready
  • STATUS Status
  • RESTARTS Restarts
  • AGE Age
  • IP Ip
  • NODE Node
  • NOMINATED_NODE NominatedNode
  • READINESS_GATES ReadinessGates
  • CONDITIONS Conditions

The CONDITIONS is filled only for Pod of a Job.

Example extended output:

{
  "apiVersion": "v1",
  "kind": "Pod",
  "kubectl": {
    "Age": "126m",
    "Conditions": "<none>",
    "Ip": "10.244.1.12",
    "Name": "alertmanager-prometheus-stack-kube-prom-alertmanager-0",
    "Node": "demo-worker",
    "NominatedNode": "<none>",
    "ReadinessGates": "<none>",
    "Ready": "2/2",
    "Restarts": 0,
    "Status": "Running"
  },
  "metadata": {
    "name": "alertmanager-prometheus-stack-kube-prom-alertmanager-0",
    "namespace": "monitoring",

Using

Configuration

Supported environment variables:

  • LOGLEVEL Log level, default: debug
  • PROXY_TARGETURL URL to kubectl proxy, default: http://localhost:8005
  • PROXY_LISTENADDR Listening address, default: :8004

Local prereq

Starting a local kubectl proxy:

kubectl proxy --reject-methods=POST,PUT,PATCH -v5

Run service manually

Running the service from shell:

./build/bin/kubeproxy-ext

Run service in Kubernetes

Example deployment can be found here: https://github.com/pgillich/grafana-kubernetes/blob/main/kubernetes/monitoring/kubectl-proxy-deployment.yaml

Testing

Example for getting Pod list:

curl 127.0.0.1:8003/api/v1/namespaces/kubernetes-dashboard/pods

Development

Remote prereq

Starting a kubectl proxy for remote development, if it's really needed:

kubectl proxy --address 0.0.0.0 --accept-hosts='.*' --reject-methods=POST,PUT,PATCH -v5

Updating k8s dependencies

Example:

tools/download-deps.sh v1.21.13

Debug in Kubernetes container with VSCode

Change command and image of kubectl-ext container of https://github.com/pgillich/grafana-kubernetes/blob/main/kubernetes/monitoring/kubectl-proxy-deployment.yaml with below values:

      - name: kubectl-ext
        command:
        - sleep
        - infinity
        image: golangci/golangci-lint:v1.44.2
        ...

Set the active namespace to monitoring in Kubernetes explorer. Attach VSCode to kubeclt-proxy Pod, select kubectl-ext container. Upload, extract and open the kubeproxy-ext repo to the container.

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.