Skip to content

Commit 4a95149

Browse files
authored
Merge pull request #1 from nigelpoulton/nigel
Adding content
2 parents 95cbdb4 + e9587d7 commit 4a95149

File tree

451 files changed

+24050
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

451 files changed

+24050
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
# Kubernetes_Deep_Dive_NP
22
A Cloud Guru - Kubernetes Deep Dive
3+
4+
The main sample app is available in the *sample-app* folder.
5+
6+
All other supporting files will be under the lesson folder with the appropriate name.
7+
8+
Enjoy!

code-k8s/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM centos:centos7
2+
3+
4+
5+
# Install Node etc...
6+
RUN yum -y update; yum clean all
7+
RUN yum -y install epel-release; yum clean all
8+
RUN yum -y install nodejs npm; yum clean all
9+
10+
# Copy source code to /src in container
11+
COPY . /src
12+
13+
# Install app and dependencies into /src in container
14+
RUN cd /src; npm install
15+
16+
# Document the port the app listens on
17+
EXPOSE 8080
18+
19+
# Run this command (starts the app) when the container starts
20+
CMD cd /src && node ./app.js

code-k8s/app.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Simple node.js web app for demonstrating containerizing apps
2+
// For quick demo purposes only (not properly maintained)
3+
'use strict';
4+
5+
var express = require('express'),
6+
app = express();
7+
8+
app.set('views', 'views');
9+
app.set('view engine', 'pug');
10+
11+
app.get('/', function(req, res) {
12+
res.render('home.pug', {
13+
});
14+
});
15+
16+
app.listen(8080);
17+
module.exports.getApp = app;

code-k8s/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "container-web-test",
3+
"private": true,
4+
"version": "0.0.1",
5+
"description": "Demo app for Web container demonstrations",
6+
"main": "app.js",
7+
"author": "Nigel Poulton <[email protected]>",
8+
"license": "Will be full of vulnerabilities!",
9+
"dependencies": {
10+
"express": "4.16.3",
11+
"pug": "2.0.3"
12+
}
13+
}

code-k8s/readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Test app for demonstrating containerizing web app
2+
3+
Super-simple Node web app for containerization demos
4+
5+
## Instructions for use
6+
7+
1. Fork the repo
8+
2. Clone repo locally
9+
3. Build Docker iamge `docker image build -t <tag> .` from within the root directory of the repo
10+
4. Push image to container registry
11+
5. Run container/Pod using the created image

code-k8s/views/home.pug

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
html
2+
head
3+
title='ACG loves K8S'
4+
link(rel='stylesheet', href='http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css')
5+
body
6+
div.container
7+
div.jumbotron
8+
h1 A Cloud Guru loves Kubernetes!!!
9+
p
10+
p
11+
a.btn.btn-primary(href="https://www.amazon.com/Kubernetes-Book-Nigel-Poulton/dp/1521823634/ref=sr_1_3?ie=UTF8&qid=1531240306&sr=8-3&keywords=nigel+poulton") The Kubernetes Book
12+
p

lesson-auto-scaling/autoscale.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
run: test
6+
name: test
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
run: test
12+
strategy:
13+
rollingUpdate:
14+
maxSurge: 1
15+
maxUnavailable: 0
16+
type: RollingUpdate
17+
template:
18+
metadata:
19+
labels:
20+
run: test
21+
spec:
22+
containers:
23+
- image: nginx:1.12
24+
name: nginx
25+
resources:
26+
limits:
27+
cpu: 1
28+
requests:
29+
cpu: 0.5

lesson-auto-scaling/hpademo.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: acg-ns
5+
---
6+
apiVersion: v1
7+
kind: Service
8+
metadata:
9+
namespace: acg-ns
10+
name: acg-lb
11+
spec:
12+
type: LoadBalancer
13+
ports:
14+
- port: 80
15+
selector:
16+
app: acg-stress
17+
---
18+
apiVersion: apps/v1
19+
kind: Deployment
20+
metadata:
21+
namespace: acg-ns
22+
labels:
23+
app: acg-stress
24+
name: acg-web
25+
spec:
26+
selector:
27+
matchLabels:
28+
app: acg-stress
29+
replicas: 1
30+
strategy:
31+
rollingUpdate:
32+
maxSurge: 1
33+
maxUnavailable: 0
34+
type: RollingUpdate
35+
template:
36+
metadata:
37+
labels:
38+
app: acg-stress
39+
spec:
40+
containers:
41+
- image: k8s.gcr.io/hpa-example
42+
name: stresser
43+
ports:
44+
- containerPort: 80
45+
resources:
46+
requests:
47+
cpu: 0.2
48+
---
49+
apiVersion: autoscaling/v1
50+
kind: HorizontalPodAutoscaler
51+
metadata:
52+
name: acg-hpa
53+
namespace: acg-ns
54+
spec:
55+
scaleTargetRef:
56+
apiVersion: apps/v1
57+
kind: Deployment
58+
name: acg-web
59+
minReplicas: 1
60+
maxReplicas: 10
61+
targetCPUUtilizationPercentage: 50

lesson-code-k8s/web-deploy.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: simple-web
5+
labels:
6+
customer: acg
7+
spec:
8+
selector:
9+
matchLabels:
10+
app: web
11+
replicas: 3
12+
strategy:
13+
type: RollingUpdate
14+
template:
15+
metadata:
16+
labels:
17+
app: web
18+
spec:
19+
containers:
20+
- image: nigelpoulton/acg-web:0.1
21+
name: web-ctr
22+
ports:
23+
- containerPort: 8080

lesson-code-k8s/web-lb.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: web-svc
5+
labels:
6+
app: web
7+
spec:
8+
type: LoadBalancer
9+
ports:
10+
- port: 80
11+
targetPort: 8080
12+
selector:
13+
app: web

0 commit comments

Comments
 (0)