Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 1.05 KB

README.md

File metadata and controls

31 lines (24 loc) · 1.05 KB

kubernetes-rust

Client Capabilities Client Support Level

Rust client for Kubernetes API.

Example

List all Pods on kube-system:

extern crate failure;
extern crate k8s_openapi;
extern crate kubernetes;

use k8s_openapi::api::core::v1 as api;
use kubernetes::client::APIClient;
use kubernetes::config;

fn main() {
    let kubeconfig = config::load_kube_config().expect("failed to load kubeconfig");
    let kubeclient = APIClient::new(kubeconfig);
    let (req, _) = api::Pod::list_namespaced_pod("kube-system", Default::default())
        .expect("failed to create a request");
    let list_pod = kubeclient
        .request::<api::PodList>(req)
        .expect("failed to list up pods");
    println!("{:?}", list_pod);
}