From 50e17b3d7f4322da15bb59e7255185cc256faed4 Mon Sep 17 00:00:00 2001 From: Brian Cunnie Date: Sun, 5 Jul 2020 08:27:53 -0700 Subject: [PATCH] k8s: deployment & nodePort service - nodePort service is merely a proof-of-concept; this won't be the final form the service takes. The port needs to be 53, not 32767. - the deployment doesn't include the nginx webserver, merely the DNS server. Also, I had trouble connecting both UDP & TCP to port 53, so I chose UDP. --- k8s/sslip.io-deployment.yml | 22 ++++++++++++++++++++++ k8s/sslip.io-nodeport-service.yml | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 k8s/sslip.io-deployment.yml create mode 100644 k8s/sslip.io-nodeport-service.yml diff --git a/k8s/sslip.io-deployment.yml b/k8s/sslip.io-deployment.yml new file mode 100644 index 0000000..ceef2db --- /dev/null +++ b/k8s/sslip.io-deployment.yml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sslip.io +spec: + template: + metadata: + name: sslip.io-pod + labels: + app: sslip.io + spec: + containers: + - name: sslip-container + image: cunnie/sslip.io + ports: + - containerPort: 53 + protocol: TCP + - containerPort: 53 + protocol: UDP + selector: + matchLabels: + app: sslip.io diff --git a/k8s/sslip.io-nodeport-service.yml b/k8s/sslip.io-nodeport-service.yml new file mode 100644 index 0000000..f38dd29 --- /dev/null +++ b/k8s/sslip.io-nodeport-service.yml @@ -0,0 +1,19 @@ +# DON'T USE THIS! +# +# NodePorts aren't the right solution; this is for personal testing +# kubectl create -f nodeport-service.yml +# dig -p 32767 127.0.0.1.sslip.io @172.17.0.2 +apiVersion: v1 +kind: Service +metadata: + name: sslip-io-nodeport-service # must be DNS-compliant +spec: + type: NodePort + ports: + - protocol: UDP + name: dns-udp + port: 53 + # targetPort: 53 + nodePort: 32767 + selector: + app: sslip.io