From 2e10bb93c242f0046213a5384231091fa3fdb765 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 15 Dec 2022 10:32:54 +0000 Subject: [PATCH] add kubectl deployment file --- .vscode/settings.json | 5 +++++ README.md | 2 +- deploy.yaml | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json create mode 100644 deploy.yaml diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b9f735b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "yaml.schemas": { + "https://json.schemastore.org/yamllint.json": "file:///home/fred.boniface/git/node.test/deploy.yaml" + } +} \ No newline at end of file diff --git a/README.md b/README.md index f966bf5..d01b0a8 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,4 @@ Where you run multiple instances it allows you to visually see how any load bala A Dockerfile is provided, or a package is available: git.fjla.uk/fred.boniface/node-test:latest. -An example deployment file for kubectl is also included - it will likely need changing for your environment. The example uses hostPort to expose the service, you may prefer to adapt it to use ingress or loadBalancer. +An example deployment file for kubectl is also included - it will likely need changing for your environment. The example uses hostPort to expose the service, you may prefer to adapt it to use ingress or loadBalancer. To use it as is, just run `kubectl apply -f https://git.fjla.uk/fred.boniface/node-test/raw/branch/main/deploy.yaml` diff --git a/deploy.yaml b/deploy.yaml new file mode 100644 index 0000000..f60636a --- /dev/null +++ b/deploy.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: Service +metadata: + name: node-test +spec: + selector: + app: node-test + ports: + - port: 80 + targetPort: 8900 + nodePort: 30900 + type: NodePort +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: node-test +spec: + replicas: 5 + selector: + matchLabels: + app: node-test + template: + metadata: + labels: + app: node-test + spec: + containers: + - name: node-test + image: git.fjla.uk/fred.boniface/node-test:latest + ports: + - containerPort: 8900 + imagePullPolicy: Always \ No newline at end of file