Skip to content

Instantly share code, notes, and snippets.

@danajp
Last active May 18, 2017 20:18
Show Gist options
  • Save danajp/7af5038829fbfef69a35590ac1d24eb4 to your computer and use it in GitHub Desktop.
Save danajp/7af5038829fbfef69a35590ac1d24eb4 to your computer and use it in GitHub Desktop.
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
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/lib/ruby/gems/2.3.0/gems/kubeclient-2.4.0/lib/kubeclient/common.rb:461:in `fetch_entities'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/kubeclient-2.4.0/lib/kubeclient/common.rb:451:in `load_entities'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/kubeclient-2.4.0/lib/kubeclient/common.rb:121:in `discover'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/kubeclient-2.4.0/lib/kubeclient/common.rb:88:in `method_missing'
from (irb):11
from /home/dana/.rbenv/versions/2.3.1/bin/irb:11:in `<top (required)>'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:74:in `load'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:27:in `run'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:332:in `exec'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:20:in `dispatch'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:11:in `start'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:34:in `block in <top (required)>'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
from /home/dana/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:26:in `<top (required)>'
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