Skip to content

Instantly share code, notes, and snippets.

@danajp
Last active May 24, 2017 15:05
Show Gist options
  • Save danajp/bbce1f6b3a1ce9755a923b67acf2ae2b to your computer and use it in GitHub Desktop.
Save danajp/bbce1f6b3a1ce9755a923b67acf2ae2b to your computer and use it in GitHub Desktop.
[net http blog] irb kubeclient
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("dev").api_endpoint,
irb(main):005:1* config.context("dev").api_version,
irb(main):006:1* {
irb(main):007:2* :ssl_options => config.context("dev").ssl_options,
irb(main):008:2* :auth_options => config.context("dev").auth_options
irb(main):009:2> }
irb(main):010:1> )
=> #<Kubeclient::Client:0x00560eddffbd28 ...>
irb(main):011:0> client.get_services
KubeException: HTTP status code 401, 401 Unauthorized
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/kubeclient-2.4.0/lib/kubeclient/common.rb:117:in `rescue in handle_exception'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/kubeclient-2.4.0/lib/kubeclient/common.rb:109:in `handle_exception'
# ...
from /home/dana/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
from /home/dana/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment