kandi X-RAY | k8s-client Summary
kandi X-RAY | k8s-client Summary
The top-level K8s::Client provides access to separate APIClient instances for each Kubernetes API Group (v1, apps/v1, etc.), which in turns provides access to separate ResourceClient instances for each API resource type (nodes, pods, deployments, etc.). Individual resources are returned as K8s::Resource instances, which provide attribute access (resource.metadata.name). The resource instances are returned by methods such as client.api('v1').resource('nodes').get('foo'), and passed as arguments for client.api('v1').resource('nodes').create_resource(res). Resources can also be loaded from disk using K8s::Resource.from_files(path), and passed to the top-level methods such as client.create_resource(res), which lookup the correct API/Resource client from the resource apiVersion and kind. The different K8s::Error::API subclasses represent different HTTP response codes, such as K8s::Error::NotFound or K8s::Error::Conflict.
Top functions reviewed by kandi - BETA
- Sends multiple requests to the server .
- Prune all resources in the list
- Parse a response object
- Merge two hashes .
- Create a new instance of the resource .
- Performs an HTTP request .
- Watch for a notification
- Fetch all available resources
- Fetches resources from resources
- Prepare a resource
k8s-client Key Features
k8s-client Examples and Code Snippets
Trending Discussions on k8s-client
I want to access the k8s configuration api through a java client or any other supported language. How can I do these kubectl commands using k8s-client :
kubectl config get-contexts
kubectl config use-context foo
ANSWERAnswered 2021-Apr-28 at 12:34
kubectl config get-contexts:
I want to watch secrets for a specific service account. How can I do it using fabric8 k8s-client ? I can create watch using a field ( like below ) but how can I do for annotation as service account detail is available as annotation ....
ANSWERAnswered 2020-Apr-18 at 20:32
You cannot, annotations are not indexed. Only labels are. You’ll have to do that filtering client side.
I have been trying to integrate spark interpreter on zeppelin (v0.7.3) on a Kubernetes cluster. However, as a complication of having k8s version 1.13.10 on the servers https://issues.apache.org/jira/browse/SPARK-28921
I needed to upgrade my spark k8s-client to v4.6.1 as indicated here https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/issues/591#issuecomment-526376703
But when I try executing a spark command
sc.version on zeppelin-ui, I get:
ANSWERAnswered 2019-Nov-05 at 01:42
After some rigorous research and help from my colleagues, I was able to verify that
io/fabric8/kubernetes/api/model/apps/Deployment didn't exist at Kubernetes-model-v2.0.0. Upgrading the jar to v3.0.0 fixed the issue.
While using the go-client API after I use the
api.PersistentVolumeClaims(namespace).Create(createOpts) call the PersistentVolumeClaim appears as a resource but stays in the Pending state. I do not see any events when using
kubectl describe pvc, I also don't see any Volumes being created etc.
ANSWERAnswered 2019-Mar-27 at 16:31
What you are doing in the code looks correct. However, it looks like that your PVC can't find a matching PV to bind together.
So most likely you will have to create a hostPath PV so that your PVC can bind to it. The volume has to be equal or greater in size as what you are requesting in your PVC.
Another option is to use a Local volume that supports dynamic provisioning which is different from hostPath.
You can debug the dynamic provisioning and binding of the PVC/PV by looking at the kube-controller-manager logs on your K8s control plane leader.
ANSWERAnswered 2017-Apr-19 at 08:00
To do so, we need to authenticate with cluster. I tried using just the Username and Password method. I get the following error:
Looking at the NodeJS client, I don't see a way to provide the cluster CA certificate along with the username and password, so unless you set
strictSSL to false this error message seems reasonable (your system is saying that it doesn't trust the certificate presented by the server, which is correct because it is a self-signed certificate authority). You may be able to work around this by installing the cluster CA certificate into your system certificate root store, but using a different authentication method (and filing a bug against the NodeJS client) seems preferable.
Then I tried the authentication using the CAcert, ClientCert and ClientKey. I basically hardcoded the keys instead of importing it from the files.
Did you also try importing files (for comparison)? It looks like this is a parsing error with the way that you are specifying the PEM blocks, and the libraries may do a better job reading the blocks from files instead of inline data.
My intuition is authentication is possible only with keys. But I think I am doing something wrong with the certs. Do I need to create some other certificates out of this or is the method of using the certs is wrong ?
Authentication should be possible with the username / password or the client keys. The NodeJS library also allows you to point to a
kubeconfig file, which should allow you to specify the username / password along with the cluster CA certificate so that you can securely connect to the API endpoint if you want to use basic auth credentials.
No vulnerabilities reported
Reuse Trending Solutions
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page