Home

Awesome

client-go

Go clients for talking to a kubernetes cluster.

We recommend using the v0.x.y tags for Kubernetes releases >= v1.17.0 and kubernetes-1.x.y tags for Kubernetes releases < v1.17.0.

The fastest way to add this library to a project is to run go get k8s.io/client-go@latest with go1.16+. See INSTALL.md for detailed installation instructions and troubleshooting.

GoDocWidget

Table of Contents

What's included

Versioning

Branches and tags.

We will create a new branch and tag for each increment in the minor version number. We will create only a new tag for each increment in the patch version number. See semver for definitions of major, minor, and patch.

The HEAD of the master branch in client-go will track the HEAD of the master branch in the main Kubernetes repo.

Compatibility: your code <-> client-go

The v0.x.y tags indicate that go APIs may change in incompatible ways in different versions.

See INSTALL.md for guidelines on requiring a specific version of client-go.

Compatibility: client-go <-> Kubernetes clusters

Since Kubernetes is backwards compatible with clients, older client-go versions will work with many different Kubernetes cluster versions.

We will backport bugfixes--but not new features--into older versions of client-go.

Compatibility matrix

Kubernetes 1.23Kubernetes 1.24Kubernetes 1.25Kubernetes 1.26Kubernetes 1.27Kubernetes 1.28
kubernetes-1.23.0/v0.23.0+-+-+-+-+-
kubernetes-1.24.0/v0.24.0+-+-+-+-+-
kubernetes-1.25.0/v0.25.0+-+-+-+-+-
kubernetes-1.26.0/v0.26.0+-+-+-+-+-
kubernetes-1.27.0/v0.27.0+-+-+-+-+-
kubernetes-1.28.0/v0.28.0+-+-+-+-+-
HEAD+-+-+-+-+-+-

Key:

See the CHANGELOG for a detailed description of changes between client-go versions.

BranchCanonical source code locationMaintenance status
release-1.19Kubernetes main repo, 1.19 branch=-
release-1.20Kubernetes main repo, 1.20 branch=-
release-1.21Kubernetes main repo, 1.21 branch=-
release-1.22Kubernetes main repo, 1.22 branch=-
release-1.23Kubernetes main repo, 1.23 branch=-
release-1.24Kubernetes main repo, 1.24 branch=-
release-1.25Kubernetes main repo, 1.25 branch
release-1.26Kubernetes main repo, 1.26 branch
release-1.27Kubernetes main repo, 1.27 branch
release-1.28Kubernetes main repo, 1.28 branch
client-go HEADKubernetes main repo, master branch

Key:

Deprecation policy

We will maintain branches for at least six months after their first stable tag is cut. (E.g., the clock for the release-2.0 branch started ticking when we tagged v2.0.0, not when we made the first alpha.) This policy applies to every version greater than or equal to 2.0.

Why do the 1.4 and 1.5 branch contain top-level folder named after the version?

For the initial release of client-go, we thought it would be easiest to keep separate directories for each minor version. That soon proved to be a mistake. We are keeping the top-level folders in the 1.4 and 1.5 branches so that existing users won't be broken.

Kubernetes tags

This repository is still a mirror of k8s.io/kubernetes/staging/src/client-go, the code development is still done in the staging area.

Since Kubernetes v1.8.0, when syncing the code from the staging area, we also sync the Kubernetes version tags to client-go, prefixed with kubernetes-. From Kubernetes v1.17.0, we also create matching semver v0.x.y tags for each v1.x.y Kubernetes release.

For example, if you check out the kubernetes-1.17.0 or the v0.17.0 tag in client-go, the code you get is exactly the same as if you check out the v1.17.0 tag in Kubernetes, and change directory to staging/src/k8s.io/client-go.

The purpose is to let users quickly find matching commits among published repos, like sample-apiserver, apiextension-apiserver, etc. The Kubernetes version tag does NOT claim any backwards compatibility guarantees for client-go. Please check the semantic versions if you care about backwards compatibility.

How to get it

To get the latest version, use go1.16+ and fetch using the go get command. For example:

go get k8s.io/client-go@latest

To get a specific version, use go1.11+ and fetch the desired version using the go get command. For example:

go get k8s.io/client-go@v0.20.4

See INSTALL.md for detailed instructions and troubleshooting.

How to use it

If your application runs in a Pod in the cluster, please refer to the in-cluster example, otherwise please refer to the out-of-cluster example.

Dependency management

For details on how to correctly use a dependency management for installing client-go, please see INSTALL.md.

Contributing code

Please send pull requests against the client packages in the Kubernetes main repository. Changes in the staging area will be published to this repository every day.