Skip to content

Instantly share code, notes, and snippets.

@jwkidd3
Last active December 21, 2018 22:34
Show Gist options
  • Save jwkidd3/876f8260eb5b22bcaab74d8e31509ef6 to your computer and use it in GitHub Desktop.
Save jwkidd3/876f8260eb5b22bcaab74d8e31509ef6 to your computer and use it in GitHub Desktop.
var http = require('http');
var handleRequest = function(request, response) {
console.log('Received request for URL: ' + request.url);
response.writeHead(200);
response.end('Hello Kubernetes');
};
var www = http.createServer(handleRequest);
www.listen(8080);
FROM node:6.14.2
EXPOSE 8080
COPY server.js .
CMD node server.js
docker build -t=<your tag> .
apiVersion: apps/v1
kind: Deployment
metadata:
name: mynodeapp
spec:
selector:
matchLabels:
app: yo
replicas: 1
template:
metadata:
labels:
app: yo
spec:
containers:
- name: mynodeapp
image: jwkidd3/webber
---
apiVersion: v1
kind: Service
metadata:
name: webber-front
labels:
app: yo
spec:
ports:
- port: 8080
selector:
app: yo
docker tag <image:latest> <image:v1>
kubetctl deployment create --image=<image:v1> <deployment name>
kubectl expose deployment <deployment name> --port=8080 --type=LoadBalancer
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment