-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the fourth lesson from the Kubernetes webinar series
- Loading branch information
ernesen
committed
Dec 11, 2017
1 parent
8bace32
commit 89ba5b2
Showing
35 changed files
with
1,173 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM node | ||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
#COPY ./app/ ./ | ||
#COPY ./ ./ | ||
COPY app.js ./ | ||
COPY package.json ./ | ||
CMD chmod +x . | ||
RUN npm install | ||
CMD ["node", "app.js"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var express = require('express'); | ||
var app = express(); | ||
|
||
var port = process.env.PORT || 8080; | ||
var color = process.env.COLOR || 'no color assigned yet'; | ||
var router = express.Router(); | ||
|
||
router.get('/', function(req, res){ | ||
res.json({ 'color': color}); | ||
}); | ||
|
||
app.use('/', router); | ||
|
||
app.listen(port); | ||
console.log('Server Started at ' + port + ' ' + 'color :' + color); | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: red | ||
labels: | ||
color: red | ||
spec: | ||
containers: | ||
- image: janakiramm/color | ||
name: red | ||
env: | ||
- name: "COLOR" | ||
value: "red" | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: green | ||
labels: | ||
color: green | ||
spec: | ||
containers: | ||
- image: janakiramm/color | ||
name: green | ||
env: | ||
- name: "COLOR" | ||
value: "green" | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: blue | ||
labels: | ||
color: blue | ||
spec: | ||
containers: | ||
- image: janakiramm/color | ||
name: blue | ||
env: | ||
- name: "COLOR" | ||
value: "blue" | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: yellow | ||
labels: | ||
color: yellow | ||
spec: | ||
containers: | ||
- image: janakiramm/color | ||
name: yellow | ||
env: | ||
- name: "COLOR" | ||
value: "yellow" | ||
ports: | ||
- containerPort: 8080 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: red | ||
spec: | ||
replicas: 3 | ||
template: | ||
metadata: | ||
labels: | ||
color: red | ||
spec: | ||
containers: | ||
- image: ernesen/node:v1 | ||
name: red | ||
env: | ||
- name: "COLOR" | ||
value: "red" | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: green | ||
spec: | ||
replicas: 3 | ||
template: | ||
metadata: | ||
labels: | ||
color: green | ||
spec: | ||
containers: | ||
- image: ernesen/node:v1 | ||
name: green | ||
env: | ||
- name: "COLOR" | ||
value: "green" | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: blue | ||
spec: | ||
replicas: 3 | ||
template: | ||
metadata: | ||
labels: | ||
color: blue | ||
spec: | ||
containers: | ||
- image: ernesen/node:v1 | ||
name: blue | ||
env: | ||
- name: "COLOR" | ||
value: "blue" | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: yellow | ||
spec: | ||
replicas: 3 | ||
template: | ||
metadata: | ||
labels: | ||
color: yellow | ||
spec: | ||
containers: | ||
- image: ernesen/node:v1 | ||
name: yellow | ||
env: | ||
- name: "COLOR" | ||
value: "yellow" | ||
ports: | ||
- containerPort: 8080 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: red | ||
spec: | ||
selector: | ||
color: red | ||
type: NodePort | ||
ports: | ||
- name: http | ||
nodePort: 31001 | ||
port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: green | ||
spec: | ||
selector: | ||
color: green | ||
type: NodePort | ||
ports: | ||
- name: http | ||
nodePort: 31002 | ||
port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: blue | ||
spec: | ||
selector: | ||
color: blue | ||
type: NodePort | ||
ports: | ||
- name: http | ||
nodePort: 31003 | ||
port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: yellow | ||
spec: | ||
selector: | ||
color: yellow | ||
type: NodePort | ||
ports: | ||
- name: http | ||
nodePort: 31004 | ||
port: 80 | ||
targetPort: 8080 | ||
protocol: TCP |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: red | ||
spec: | ||
selector: | ||
color: red | ||
type: NodePort | ||
ports: | ||
- name: http | ||
nodePort: 31001 | ||
port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: green | ||
spec: | ||
selector: | ||
color: green | ||
type: NodePort | ||
ports: | ||
- name: http | ||
nodePort: 31002 | ||
port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: blue | ||
spec: | ||
selector: | ||
color: blue | ||
type: NodePort | ||
ports: | ||
- name: http | ||
nodePort: 31003 | ||
port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: yellow | ||
spec: | ||
selector: | ||
color: yellow | ||
type: NodePort | ||
ports: | ||
- name: http | ||
nodePort: 31004 | ||
port: 80 | ||
targetPort: 8080 | ||
protocol: TCP |
Oops, something went wrong.