mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-31 06:41:52 +00:00
clientgo/examples: add ToC for examples
Also add authenticate- prefix to auth samples. Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com> Kubernetes-commit: 62d1251874cb259d38d727300ac4b2646c4122c8
This commit is contained in:
parent
2163038fbf
commit
6df6f2148a
28
examples/README.md
Normal file
28
examples/README.md
Normal file
@ -0,0 +1,28 @@
|
||||
# client-go Examples
|
||||
|
||||
This directory contains examples that cover various use cases and functionality
|
||||
for client-go.
|
||||
|
||||
### Configuration
|
||||
|
||||
- [**Authenticate in cluster**](./in-cluster-client-configuration): Configure a
|
||||
client while running inside the Kubernetes cluster.
|
||||
- [**Authenticate out of cluster**](./out-of-cluster-client-configuration):
|
||||
Configure a client to access a Kubernetes cluster from outside.
|
||||
|
||||
### Basics
|
||||
|
||||
- [**Managing resources with API**](./create-update-delete-deployment): Create,
|
||||
get, update, delete a Deployment resource.
|
||||
|
||||
### Advanced Concepts
|
||||
|
||||
- [**Work queues**](./workqueue): Create a hotloop-free controller with the
|
||||
rate-limited workqueue and the [informer framework][informer].
|
||||
- [**Third-party resources (deprecated)**](./third-party-resources-deprecated):
|
||||
Register a custom resource type with the API, create/update/query this custom
|
||||
type, and write a controller drives the cluster state based on the changes to
|
||||
the custom resources.
|
||||
|
||||
[informer]: https://godoc.org/k8s.io/client-go/tools/cache#NewInformer
|
||||
|
@ -9,7 +9,7 @@ load(
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "in-cluster",
|
||||
name = "in-cluster-client-configuration",
|
||||
library = ":go_default_library",
|
||||
tags = ["automanaged"],
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
# Authenticating inside the cluster
|
||||
|
||||
This example shows you how you can write an application that authenticates to
|
||||
the Kubernetes API while it is running on a Kubernetes cluster.
|
||||
This example shows you how to configure a client with client-go to authenticate
|
||||
to the Kubernetes API from an application running inside the Kubernetes cluster.
|
||||
|
||||
client-go uses the [Service Account token][sa] mounted inside the Pod at the
|
||||
`/var/run/secrets/kubernetes.io/serviceaccount` path when the
|
||||
@ -11,7 +11,7 @@ client-go uses the [Service Account token][sa] mounted inside the Pod at the
|
||||
|
||||
First compile the application for Linux:
|
||||
|
||||
cd in-cluster
|
||||
cd in-cluster-client-configuration
|
||||
GOOS=linux go build -o ./app .
|
||||
|
||||
Then package it to a docker image using the provided Dockerfile to run it on
|
@ -9,7 +9,7 @@ load(
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "out-of-cluster",
|
||||
name = "out-of-cluster-client-configuration",
|
||||
library = ":go_default_library",
|
||||
tags = ["automanaged"],
|
||||
)
|
@ -1,7 +1,8 @@
|
||||
# Authenticating outside the cluster
|
||||
|
||||
This example shows you how to authenticate to the Kubernetes API from an
|
||||
application running outside the Kubernetes cluster with client-go.
|
||||
This example shows you how to configure a client with client-go to authenticate
|
||||
to the Kubernetes API from an application running outside the Kubernetes
|
||||
cluster.
|
||||
|
||||
You can use your kubeconfig file that contains the context information
|
||||
of your cluster to initialize a client. The kubeconfig file is also used
|
||||
@ -14,7 +15,7 @@ Make sure your `kubectl` is configured and pointed to a cluster. Run
|
||||
|
||||
Run this application with:
|
||||
|
||||
cd out-of-cluster
|
||||
cd out-of-cluster-client-configuration
|
||||
go build -o app .
|
||||
./app
|
||||
|
Loading…
Reference in New Issue
Block a user