Skip to content

Instantly share code, notes, and snippets.

View Vectormike's full-sized avatar
🏠
Working from home

Victor Jonah Vectormike

🏠
Working from home
View GitHub Profile
spec:
replicas: 5
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
kubectl create -f deployment.yaml
---
kind: Service
apiVersion: v1
metadata:
name: sampleservice
spec:
selector:
app: myapp
ports:
- protocol: "TCP"
docker run -p 8080:8080 your-docker-hub-username/kubernetes_deploy:v1
docker build -t your-docker-hub-username/kubernetes_deploy:v1 .
FROM node:18-buster-slim
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
{
"name": "kubernetes_deploy",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
npm init -y
'use strict';
const express = require('express');
const PORT = 8080;
const HOST = '0.0.0.0';
const app = express();
app.get('/', (req, res) => {
res.send('Kubernetes Deployment');