...
1# client-go Examples
2
3This directory contains examples that cover various use cases and functionality
4for client-go.
5
6### Auth plugins
7
8Client configuration is typically loaded from kubeconfig files containing server and credential configuration.
9Several plugins for obtaining credentials from external sources are available, but are not loaded by default.
10To enable these plugins in your program, import them in your main package.
11
12You can load all auth plugins:
13```go
14import _ "k8s.io/client-go/plugin/pkg/client/auth"
15```
16
17Or you can load specific auth plugins:
18```go
19import _ "k8s.io/client-go/plugin/pkg/client/auth/azure"
20import _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
21import _ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
22```
23
24### Configuration
25
26- [**Authenticate in cluster**](./in-cluster-client-configuration): Configure a
27 client while running inside the Kubernetes cluster.
28- [**Authenticate out of cluster**](./out-of-cluster-client-configuration):
29 Configure a client to access a Kubernetes cluster from outside.
30
31### Basics
32
33- [**Managing resources with API**](./create-update-delete-deployment): Create,
34 get, update, delete a Deployment resource.
35
36### Advanced Concepts
37
38- [**Work queues**](./workqueue): Create a hotloop-free controller with the
39 rate-limited workqueue and the [informer framework][informer].
40- [**Custom Resource Definition (CRD)**](https://git.k8s.io/apiextensions-apiserver/examples/client-go):
41 Register a custom resource type with the API, create/update/query this custom
42 type, and write a controller that drives the cluster state based on the changes to
43 the custom resources.
44- [**Leader election**](./leader-election): Demonstrates the use of the leader election package, which can be used to implement HA controllers.
45
46[informer]: https://godoc.org/k8s.io/client-go/tools/cache#NewInformer
47
48### Testing
49
50- [**Fake Client**](./fake-client): Use a fake client in tests.
View as plain text