Comments (5)
This func is exactly what I was looking for.
Ok, glad it's so easy then. :)
Perhaps adding to the documentation will prevent others from making this mistake.
I'll gladly clarify the docs. This is a part that Cory implemented and documented and I've never gone over it. Once you're too deep you don't look at those "first step" docs anymore.
Leaving this open for now.
from k8s.
Decided to improve the @moduledoc
and @doc
of K8s.Conn
. I think it's the first place people look (right @znorris?)
from k8s.
Hi @znorris
Have you seen the usage guide on connections?
Since you're writing "in cluster", I'm assuming you're using k8s
inside a pod and are trying to access resources inside the same cluster this pod is running in. If that's the case, all you need is to have RBAC set up correctly for the pod's service account and call K8s.Conn.from_service_account/1
to get a %K8s.Conn{}
struct used to connect to the cluster.
Given RBAC is set up accordingly, the following code would get a list of namespaces of the cluster this code is running in:
{:ok, conn} = K8s.Conn.from_service_account()
{:ok, namespace_list} =
K8s.Client.list("v1", "Namespace")
|> K8s.Client.put_conn(conn)
|> K8s.Client.run()
I'm a bit confused on why you've mentioned workload identity. Running inside GKE you would use workload identity to authenticate as a Google Service Account in order to access Google Cloud resources, e.g. Google Cloud Storage etc. But that's not what this library is used for.
Unless we're talking about the use case where your code is running in a GitHub workflow, trying to access the GKE cluster using federated workload identity. Is that it?
from k8s.
@mruoss Thanks for your quick reply. I'm doing too many things at once and erroneously conflated workload identity.
I did read all if it several times. However, it wasn't clear to me that this was the in cluster configuration as I've never used the service account directory before. Perhaps adding to the documentation will prevent others from making this mistake.
This func is exactly what I was looking for.
from k8s.
Thank you @mruoss, very helpful.
from k8s.
Related Issues (20)
- Source links in the documentation are incorrect HOT 3
- Read kube config from string
- 2.0.0-rc.1 doesn't work with kind clusters HOT 6
- Configuration of http_provider and discovery_driver is ignored HOT 13
- Large resources unusable with 2.0.0 HOT 6
- Does the watch steam handle disconnects in V2? HOT 13
- Patch strategy should be configurable HOT 5
- hostname issues HOT 7
- Streams resetting resource version HOT 4
- K8s.Conn.Config does not exist HOT 4
- what is different between k8s lib and swarm ? HOT 2
- Support pods/logs subresource streaming HOT 5
- Exception raised when running too many get requests HOT 6
- Mint HTTPAdapter failure cycle spams errors HOT 1
- Hex.pm Usage Guide doc is unavailable HOT 2
- Http2 Adapter causing 500 requests HOT 10
- Long-lasting shell connection example is broken HOT 4
- Connections being closed -- K8s.Client.Mint.HTTPAdapter Connection closed for reading and writing - stopping this process. HOT 2
- ArgumentError in K8s.Client.Mint.ConnectionRegistry on TCP Connection HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from k8s.