Skip to content

Instantly share code, notes, and snippets.

@danajp
Created May 23, 2017 19:03
Show Gist options
  • Save danajp/7c255b54347a484e6cc14fd430202cad to your computer and use it in GitHub Desktop.
Save danajp/7c255b54347a484e6cc14fd430202cad to your computer and use it in GitHub Desktop.
[net http blog] irb kubeclient working
irb(main):001:0> require "kubeclient"
=> true
irb(main):002:0> config = Kubeclient::Config.read("/home/dana/.kube/config")
=> #<Kubeclient::Config:0x00560ede0bc528 ...>
irb(main):003:0> client = Kubeclient::Client.new(
irb(main):004:1* config.context.api_endpoint,
irb(main):005:1* config.context.api_version,
irb(main):006:1* {
irb(main):007:2* :ssl_options => config.context.ssl_options,
irb(main):008:2* :auth_options => config.context.auth_options
irb(main):009:2> }
irb(main):010:1> )
=> #<Kubeclient::Client:0x00560eddffbd28 ...>
irb(main):011:0> client.get_services
=> [#<Kubeclient::Service metadata={:name=>"kubernetes", :namespace=>"default", :selfLink=>"/api/v1/namespaces/default/services/kubernetes", :uid=>"7820ec5c-cedc-11e6-93e9-0ee46d269912", :resourceVersion=>"33", :creationTimestamp=>"2016-12-30T22:08:18Z", :labels=>{:component=>"apiserver", :provider=>"kubernetes"}}, spec={:ports=>[{:name=>"https", :protocol=>"TCP", :port=>443, :targetPort=>443}], :clusterIP=>"172.28.0.1", :type=>"ClusterIP", :sessionAffinity=>"ClientIP"}, status={:loadBalancer=>{}}>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment