Add to Watchlist

Managing Kubernetes from Python using Kube

22 views

Citation of segment
Embed Code
Purchasing a DVD Cite video

Formal Metadata

Title Managing Kubernetes from Python using Kube
Title of Series EuroPython 2016
Part Number 17
Number of Parts 169
Author Charles, David
License CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license.
DOI 10.5446/21124
Publisher EuroPython
Release Date 2016
Language English

Content Metadata

Subject Area Computer Science
Abstract David Charles - Managing Kubernetes from Python using Kube Kubernetes is the Google Borg inspired control plane for Docker containers. It has a great API but needs a load of HTTP client code and JSON processing to use it from Python. This talk introduces Kube, a Python wrapper around the Kubernetes API that enables you to manage your Kubernetes cluster in a pythonic way while avoiding any Kubernetes API peculiarities. Programmers and operations folk who are interested in interacting with the Kubernetes API using Python. ----- Docker has had a transformative influence on the way we deploy software and Kubernetes, the Google Borg inspired control plane for Docker-container- hosting-clusters, is gaining similar momentum. Being able to easily interact with this technology from Python will become an increasingly important capability in many organisations. I'll discuss what the motivations behind writing Kube. We'll dive into Kube using the Python interactive interpreter, getting connected to the API, and simple viewing and label update operations. Finally I'll discuss more advanced resource management activities like Kube's 'watch' API capability. ## Objectives Attendees will learn about the key concepts in getting resource information out of their Kubernetes cluster using Kube. ## Outline 1. Setting the scene (3 minutes) 1. Other Python kubernetes wrappers (2 minutes) 1. Kubernetes concepts quick recap (5 minutes) 1. Dive into Kube in the Python interactive interpreter (10 minutes) * Outline prerequisites * The entry point - a Cluster instance * Views and Items - two important Kube concepts * Item meta data: labels and versions 1. More Kube features (5 minutes) * Creating and deleting resources * Using Kube's Watch API support * The cluster proxy attribute for when you need to get at the actual API. 1. Q&A (5 minutes)
Series
Annotations
Transcript
Loading...
the on hi my mind and I will be you have to do with to the students have and you know you have do this from by using you always want to share with you my belief here briefly and in some
ways to mitigate the Internet and then only presentation to you use it in a while I submitted my talk to you about that always has and always have a way of life so you have segments of the acceptance of the ones very to go to get all of the public domain while I'm here and I went to from the differences and all but 1 of them is the most important of all I think it is going to be used in other news interesting
to In this condition only once
and it was also point stressing the need for that so we have a tendency to
the sense of what on the right 1 thing that from Poland and so
I don't want you to stop them but with entities in the nineties by the this leads to a lot of and also the fact that the only way to find
things like that the of muscles and not and
time and which happened in to be the cell of the number of people in the so that the
models of the particle so this this is not really what I would like to see what the
article by the time you think that this region has to be some way to that
the and you will have to be user can you
really how do you decide to use and understand it and here you can
and I want you to think about everything you will want to use the
secessionist development the going to be a power in normally so so you might want listen to product of event in the history of a single project variable that monitors on the market and the thing that we have a lot of and I this that on your own you know we have to make technology from all of the monitors that that just qualities and we built prior to that date and it was you know that you do know that right because the voices offers service and we chose the engine and i j k and decays the hosted the recent mutations so the good will provide and so we will become parking adopted we wanted to use are in solution to monitor stuff but also we need to to provisions of the monetary instances for customers signing up to fast so they can actually you know you click a button and monitoring instance be deployed on the reading and so do we need to interact with the music I will like people so we have to buy and so that's why we we're now it's important to say that there all other the represent and and adding strongly encourage you to go off and look at the and so you can see how progress that on has the unnecessary and don't have a lot a lot better fit for you and also the the end another using 1 of these instead of talking if the regret if you come back and tell us what thought better because that it is interesting to know we could try and fix anything we've got going on out but that we're also working in a way we're OK because we want to abstract away from what somewhat moving target as far as API goes and it's also got some idiosyncrasies but you don't necessarily need the and be exposed to when your when you're interacting with with the the parts they got so we want to kind of like rain opinionated because the API and the things a little more particles the of the of the use of it we also want to clean what interface and what interface allows you to from restorative gets of litigation called changes to resources within the range some of the other offerings about tolerance come gone and since we started with some balls about that didn't do that very well so we want to something quite funny and we can only use like a generation striker and that's the theme in some of these alternatives but you know what you guys take a look and and take and so on I hate it when I took speakers so and so do you know that that's a very quick chances to has kind of been exposed I think so the idea was to try to remedy this because times a premium so so is about all the streets in the and of the container center and and but not just documents the became attitudes about systems and if any of you've been exposed to lots and lots of some of the concept of what it gives you this on and the basically the mutual deployment component is easy and there's the runtime environment that forms of and it's a allows you to develop useful deployment component in the the devil practices can contribute to what so across multiple nodes how to manage and of containers in the role of so that is can so that's why control things like communities and the whole thing
about and I mean did already did this still have system will have a system call on which uses that actually containers and the managers the cross the and was allowed to go to scale and developer productivity and the number of services are offered to the customers internationally and without a corresponding increase in operational overheads so obviously you know about it was a useful a useful technology the ladies had an amazing amount of momentum behind it is interesting how many includes competitive of actual behind readings were initially they hold positions of direct competitors to give each constants and into the knowledge that they have to to get rid all made in cluster management and all managing contain lot very very large scale and then they they seem to have a always sold to accommodates communities and in their offering in that space so to so like so offering hasn't really done for because that is you try to use of so so to work at the excellent of yeah is
not very helpful like on the ground you that I'm so that was avoided through
simply constant so in the rate is we have the idea of a cluster which is a single homogenous unclustered nodes computers also have to watch out for a single abilities of which is kind of of attempts to federate multiple previous clusters so you can have based in multiple clusters with different kinds of shapes of results inside and then there is so some results where the where also settlement calls are the smallest unit scheduling and runs the actual contain so doctor but not exclusively Dr. also support coming for the containers and the docks contains right solid the pot and then the things that you need to use such system contractual the the concept of replica sets of some and what they do is they specification that defines the the and then the harmony of replicas of those called there needs of the full scale and resilience of this also services such as Thomas Hobbes and expose that take T. that did to the BBC's clusters so that you can think about the actual the containers exposed it has never services and then the actual much services and then the service definitions provide actual services for consumers labels interesting thing and we'll be looking at a very very quickly and that the value has the associated with the resources within communities but they want change of a set of organize the author with in and there's lots of the stuff that we talk about the last enough to get going through the next part of the of the talk about something something that is so some of the some key concepts for q that we need to get some history really like to beginning is the principally duties API defines a and b of different kinds and defines result to so it kind is the name of an object schema essentially as a resource types and resources a representation of assistance to and that's central route retrieved from the API projects and the operation and the result is to touch resources of collections and so these connectivity to turn them using a linear map us in the he and so for example all upon results and whereas new discoveries and new list results and the collection so try never mind additionally it's really important to understand the separation of specification status including the of when an API states that of the specification of the
resources rotating might and that's available immediately and so that was sort of atomic operation but over time communities will work to to bring the status of the results of the specifications change of tools specification the system world drive toward the most recent spec come and that makes the the behavior communities that are based on that based on which it's quite a nice feature a case study that attribute gets done the I'm going to consume when the there would be from moment the trial error this display yeah what's called it's a lot of running here is some yeah what could you actually try to fusion now so when now at the FIL and so on got a single node given cluster running on white member care about whether there was interested in there's reason to do it was interested in and they considered standard we don't want the right so what I'm going to do that so I think if you don't it so it is important to Singapore right America thing where I was like really just like the results of critical woman trying to write stuff the next and so OK and so the the the entry point in the debate guide is music trust so we can say is cluster the course of a few people cluster immigration
instance 1 of the things that gives us a cluster object of so there is is an if you want if you all the cases 1 thing I forgot to mention was when y'all interacting that you need to the and the 3rd 1 approach is to run a few control proxy and what that does is it it proxies the he control API from where returning to the post of machine so what I've got here is quite simply keep control proxy intercepts data running it and if you're running you'll python code using q
you know in a container of in modern readers of like architects articles the ones running the proxy and 1 from your point a so the other thing I can do here is like can specified in the URL if the the if the proxy is running on a non-standard endpoint will pull and so it was like well there's a whole theory that the war on the side the island something like that but them beginning the clustering so the these content managers about some the and say this is my point here if you cost so we talk about this in a sense so that return the notes and that becomes so that the ways to actually create your your entry point the numbers of clusters so totally recollections and elements while there are some presented here as and the views and items so that kind of node this thing here is plural you can see that's actually on the node list so that's a collection of I can do it right so that the government to get actual you and and so the sum of the future nodes of and the cluster of objects has a few of these things many of these things because the documentation is along with the dogs it's a work in progress on the list of essentials in the and and uh we can see things like clusters represents an and namespaces and that kind of stuff so like so we want to get results automatically so I can say something like Morris going it represents come from a cluster to represent for computer effects and I need to specify the name now something I prepared earlier by I this is just a few control the following online and I can get the rough sets 1
article on called systemic and so on this
side again made service of after the the namespace names but the course from just the name space without running a if you have a should be allowed and and then we are absolutely represent right now so this is an actual and an element as opposed to the collection and it's got to match these associated with it so I can say with its and metadata and access to what name is a behold it's a step size of the of thing that and conceal namespace that came from and like services for labels associated with not until replica variance because of what was OK so what's important to remember about results resources so that the notion of communities versions all results returns across the API if remember when I was talking about separation all spec and status and when you get given and the results of back exposure and so now we can see here that RST documents at all those from the use of and so n and so on and
off the French was something different really is that these of these collections of actually iterating so I could include things like a list comprehension so I can say IRS for Morrison in clusters adult replica sets and you get with
it will be at least as back up so I can build a list say for example saying and you don't want to talk to the and for that 1st of all nodes just getting list of all the motions that for all the nodes in the cluster so that 1 of the things that I think he did and then you will the conversion
from outside the states of the of the of the node resources changed because some things change rather than just like he's decided in that the hearing the reported was so when y'all interacting and 3 uh asexually which replaces the nobility and otherwise you need to be of looking at stuff that's going to and a case so back to ladies and so the sum of replicas sets the project we had some and it's got some labels associated with each 1 of them sexual dictionary so you can do stuff like the key to run the wrong actually and then get value system and this is how it the mutual so economists right and
that kind of design decisions and all of about half a balance when we're writing here we wanted every operation to be done by assessing and so you can update the label using a set amount so you can say something like that this strategy with food and set it in they were and we get a value the predictable told comes at a so we get 1 back into this and looking for it was what was going on and on and on and on matters of and it's not like a traditional and so uh that's because I'm actually looking at but the old version of porous because text wonderful returned from the and then area called evolution and so what kind of research the can and the user miscomprehension because on the 1 rest for interested in represents the 1st by
that much should Rs and therefore the cost of version of the goal is to select a different version of the Regulation on some of our installed metal labels and we see all through the actual development of so that's really not them on the site of Sunday's enable is kind of same as the creating the late so I can do that is returned by the you except which I assigned to a variable so the that of our solution on the new version of the labels in the dataset on that so of so so to go about labels a lot of money on use of easy to do this and that and the other thing is on a very good way of managing your duties as fast as you want manage and the way you all resources you can vote and run services central all managed and that it is setting up recently was word during the OK so we can also deleted was so that we can cite chorus and got a set of labels for all the time because they want leave the and report 2nd time management assignments to partners and the corresponding so there
the OK so that's kind of the end of the that it belongs to this that for thank you very much OK so
so briefly talk about some of the features that have the time to damage and and in the latest version of all of you we've got creating into these resources which have to Mexico useful so that during the reign of the cost of represents subsistence which is a lot of stuff and it's just a simple grade school you also in a project specifications and those that's called the and loss of all watch API and implementation which you know are safe from others and let's say this is vertical of and my colleague you wrote that it actually brought about the health of and this is done in 48 hours but is insulated from the horror of fact all using Python and the and and yet it's me but there's also if you remember the fixed Mumbai you've used got to get results items from collections and here is active filter capabilities you can filter the returned results on and on and on and on their bodies which is also a really nasty and I'm really having a child finally in the last instance which is the entry point as a proxy to the duties API so it was a child and you will get the actual ideology and I want to use in the you just just properties
I think so some questions in the song the year and are interested to hear you think of something you want it should be on on or if it doesn't that people have about a sharp intake of breath from some audiences of also about that and and anyway that's where this happened to me that the objective of the among k b's 36 years follow me on Twitter because I'm funny and uh yeah so I'll take questions if we got time the and this is what
our would you like to hear your because that is the question was and always molecule we can and consists and yes wherein the vendor area and we've got all is that we use of green other copies we will see that that fancy the graphics adapter
monitor on and we can show you know and where requested a meeting with Sharon got that jealous and likely the way is 1 of the development of test and so some of you may this
and the OK so the question was what version of communities working with there was what is the difference the we OK so this is the page number of and and it just represents some version of the results can to compress the last time the results chain that depending on resource type the kind you like could be anything so for example for a node it could be because something that these changes could be could be because the labels updated on replication on a replica so it that's when the version number is incremented not just when you make call carries itself changes the the the results you want no so so what I should have said was of they don't rely on the version numbers just always get the latest version of the object so I just show you I show you those numbers I thought advised the GOP with numbers but I just wanted an interesting thing so then but you know the answer to think all you but OK can't do that's what and because yet and they will give you get surrounded on average also give you read thanks
Computer animation
Student's t-test
Video game
Computer animation
Presentation of a group
Internetworking
1 (number)
Public domain
Subtraction
Subset
Condition number
Point (geometry)
Computer animation
Particle system
Meeting/Interview
Cellular automaton
Multiplication sign
Scientific modelling
Number
Computer animation
Meeting/Interview
Multiplication sign
Game controller
Musical ensemble
Service (economics)
Pay television
Euler angles
Connectivity (graph theory)
Multiplication sign
Range (statistics)
Mereology
Run-time system
Event horizon
Power (physics)
Goodness of fit
Mathematics
Lecture/Conference
Single-precision floating-point format
Physical system
Electric generator
Product (category theory)
Software developer
Projective plane
Fitness function
Interface (computing)
Instance (computer science)
Variable (mathematics)
Particle system
Exterior algebra
Vertex (graph theory)
Right angle
Gastropod shell
Mutual information
Arithmetic progression
Reading (process)
Scaling (geometry)
Momentum
Spacetime
Overhead (computing)
Service (economics)
Product (category theory)
Correspondence (mathematics)
Software developer
Direction (geometry)
Cluster analysis
System call
Number
Computer animation
Operator (mathematics)
Data management
Reading (process)
Position operator
Physical system
Scheduling (computing)
Musical ensemble
Multiplication sign
Shape (magazine)
Mereology
Mathematics
Bit rate
Atomic number
Single-precision floating-point format
Electronic visual display
Vertex (graph theory)
Error message
Physical system
Service (economics)
Moment (mathematics)
Electronic mailing list
Cluster analysis
Connected space
Right angle
Quicksort
Linear map
Data type
Resultant
Point (geometry)
Service (economics)
Observational study
Set (mathematics)
Electronic program guide
Electronic mailing list
Latent heat
Operator (mathematics)
Touch typing
Representation (politics)
Subtraction
Units of measurement
Multiplication
Standard deviation
Scaling (geometry)
Business cluster
Key (cryptography)
Computer
Projective plane
Set (mathematics)
System call
Computer animation
Personal digital assistant
Vertex (graph theory)
Key (cryptography)
Object (grammar)
Routing
Business cluster
Separation axiom
Point (geometry)
Game controller
Code
Set (mathematics)
View (database)
Virtual machine
1 (number)
Computer
Theory
Number
Theory of everything
Proxy server
Hidden surface determination
Namespace
Element (mathematics)
Cluster analysis
Electronic mailing list
Sound effect
Instance (computer science)
Set (mathematics)
Summation
Computer animation
Personal digital assistant
Computer cluster
Vertex (graph theory)
Object (grammar)
Business cluster
Data management
Arithmetic progression
Curve fitting
Resultant
Satellite
Service (economics)
Namespace
Element (mathematics)
Variance
Metadata
Maxima and minima
Revision control
CAN bus
Computer animation
Electronic meeting system
Resultant
Separation axiom
Service (economics)
Inheritance (object-oriented programming)
Electronic mailing list
Cluster analysis
Weight
Set (mathematics)
Computer animation
Uniform resource name
Vertex (graph theory)
Maize
Data conversion
Information security
Units of measurement
Business cluster
State of matter
Set (mathematics)
Decision theory
Home page
Ordinary differential equation
Revision control
Strategy game
Operator (mathematics)
Maize
Conditional-access module
Physical system
Chi-squared distribution
Area
Service (economics)
Key (cryptography)
Chemical equation
Computer file
Projective plane
Code
Weight
Set (mathematics)
Port scanner
Evolute
Ratsche <Physik>
Summation
Computer animation
Personal digital assistant
IRIS-T
Writing
Service (economics)
Computer chess
Manufacturing execution system
Service (economics)
Regulator gene
Ring (mathematics)
Set (mathematics)
Software developer
Multiplication sign
FIESTA <Programm>
Cloud computing
Set (mathematics)
Port scanner
Video game
Revision control
Word
Computer animation
Multi-agent system
Website
Maize
Conditional-access module
Traffic reporting
Data management
Point (geometry)
Implementation
Proxy server
Business cluster
View (database)
Multiplication sign
Gradient
Projective plane
Attribute grammar
Insertion loss
Instance (computer science)
Revision control
Category of being
Latent heat
Proxy server
Resultant
Area
Graphics processing unit
Computer animation
Knowledge base
Multiplication sign
Object (grammar)
Twitter
Web page
Software developer
Multiplication sign
Replication (computing)
System call
Number
Revision control
Chaining
Mathematics
Computer animation
Lattice (order)
Average
Vertex (graph theory)
Software testing
Object (grammar)
Data type
Subtraction
Resultant
Loading...
Feedback

Timings

  520 ms - page object

Version

AV-Portal 3.8.0 (dec2fe8b0ce2e718d55d6f23ab68f0b2424a1f3f)