This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):116:0> cert_store = OpenSSL::X509::Store.new | |
=> #<OpenSSL::X509::Store:0x00560ede1504f8 @verify_callback=nil, @error=nil, @error_string=nil, @chain=nil, @time=nil> | |
irb(main):117:0> cert_store.add_file("/home/dana/.minikube/ca.crt") | |
=> #<OpenSSL::X509::Store:0x00560ede1504f8 @verify_callback=nil, @error=nil, @error_string=nil, @chain=nil, @time=nil> | |
irb(main):118:0> | |
irb(main):119:0* Net::HTTP.start( | |
irb(main):120:1* "192.168.99.100", | |
irb(main):121:1* 8443, | |
irb(main):122:1* :use_ssl => true, | |
irb(main):123:1* :cert_store => cert_store, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl --cacert ~/.minikube/ca.crt --cert ~/.minikube/apiserver.crt --key ~/.minikube/apiserver.key https://192.168.99.100:8443/version | |
{ | |
"major": "1", | |
"minor": "6", | |
"gitVersion": "v1.6.0", | |
"gitCommit": "fff5156092b56e6bd60fff75aad4dc9de6b6ef37", | |
"gitTreeState": "dirty", | |
"buildDate": "2017-04-07T20:43:50Z", | |
"goVersion": "go1.7.1", | |
"compiler": "gc", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):130:0> Net::HTTP.start( | |
irb(main):131:1* "k8s.dev.use1.int.greenhouse.io", | |
irb(main):132:1* 443, | |
irb(main):133:1* :use_ssl => true, | |
irb(main):134:1* :cert => OpenSSL::X509::Certificate.new(File.read("/home/dana/.kube/k8s-admin.pem")), | |
irb(main):135:1* :key => OpenSSL::PKey.read(File.read("/home/dana/.kube/k8s-admin-key.pem")), | |
irb(main):136:1* ) do |http| | |
irb(main):137:1* http.request(Net::HTTP::Get.new("/version")) | |
irb(main):138:1> end | |
=> #<Net::HTTPUnauthorized 401 Unauthorized readbody=true> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -sv https://k8s.dev.use1.int.greenhouse.io/version |& grep '<' | |
< HTTP/1.1 401 Unauthorized | |
< Content-Type: text/plain; charset=utf-8 | |
< X-Content-Type-Options: nosniff | |
< Date: Thu, 18 May 2017 13:24:01 GMT | |
< Content-Length: 13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl --cert ~/.kube/k8s-admin.pem --key ~/.kube/k8s-admin-key.pem https://k8s.dev.use1.int.greenhouse.io/version | |
{ | |
"major": "1", | |
"minor": "5", | |
"gitVersion": "v1.5.4+coreos.0", | |
"gitCommit": "97c11b097b1a2b194f1eddca8ce5468fcc83331c", | |
"gitTreeState": "clean", | |
"buildDate": "2017-03-08T23:54:21Z", | |
"goVersion": "go1.7.4", | |
"compiler": "gc", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl get service | |
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE | |
kubernetes 172.28.0.1 <none> 443/TCP 138d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
clusters: | |
- cluster: | |
certificate-authority: greenhouse-root-ca.pem | |
server: https://k8s.dev.use1.int.greenhouse.io | |
name: dev | |
- cluster: | |
certificate-authority: /home/dana/.minikube/ca.crt | |
server: https://192.168.99.100:8443 | |
name: minikube |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import sys | |
try: | |
import ConfigParser as configparser | |
except ImportError: | |
import configparser |