Skip to content

Commit ba61aea

Browse files
committed
move skippbox/notebooks to client-python for GSoC
1 parent dbe83ef commit ba61aea

File tree

6 files changed

+584
-0
lines changed

6 files changed

+584
-0
lines changed

examples/notebooks/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Jupyter Notebooks for Kubernetes
2+
================================
3+
4+
This is a set of Jupyter notebooks to learn the Kubernetes API in Python.
5+
6+
Launch the deployment and create the service.
7+
8+
```
9+
kubectl create -f docker/jupyter.yml
10+
```
11+
12+
Open your browser on the jupyter service and go through the notebooks.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"collapsed": true
8+
},
9+
"outputs": [],
10+
"source": [
11+
"from kubernetes import client, config"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": null,
17+
"metadata": {
18+
"collapsed": true
19+
},
20+
"outputs": [],
21+
"source": [
22+
"client.Configuration().host=\"http://localhost:8080\""
23+
]
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": null,
28+
"metadata": {
29+
"collapsed": true
30+
},
31+
"outputs": [],
32+
"source": [
33+
"extensions = client.ExtensionsV1beta1Api()"
34+
]
35+
},
36+
{
37+
"cell_type": "code",
38+
"execution_count": null,
39+
"metadata": {
40+
"collapsed": true
41+
},
42+
"outputs": [],
43+
"source": [
44+
"body = extensions.V1beta1Deployment()\n",
45+
"namespace = \"default\"\n",
46+
"\n",
47+
"deployment = client.V1beta1Deployment()\n",
48+
"deployment.metadata = client.V1ObjectMeta(name=\"jupyter\")\n",
49+
"spec = client.V1beta1DeploymentSpec()\n",
50+
"spec.template = client.V1PodTemplateSpec()\n",
51+
"spec.template.metadata = client.V1ObjectMeta()\n",
52+
"spec.template.spec = client.V1PodSpec()\n",
53+
"\n",
54+
"\n",
55+
"extensions.create_namespaced_deployment(namespace, body)"
56+
]
57+
}
58+
],
59+
"metadata": {
60+
"kernelspec": {
61+
"display_name": "Python 2",
62+
"language": "python",
63+
"name": "python2"
64+
},
65+
"language_info": {
66+
"codemirror_mode": {
67+
"name": "ipython",
68+
"version": 2
69+
},
70+
"file_extension": ".py",
71+
"mimetype": "text/x-python",
72+
"name": "python",
73+
"nbconvert_exporter": "python",
74+
"pygments_lexer": "ipython2",
75+
"version": "2.7.12"
76+
}
77+
},
78+
"nbformat": 4,
79+
"nbformat_minor": 1
80+
}

0 commit comments

Comments
 (0)