adn
adn

Reputation: 3

Deploying Kubernetes Cluster + Wordpress on Ubuntu 18.04 VPS pointing to my domain

Scenario: I'm trying to learn some K8s by re-creating my current stack with containers and container orchestration.

Background: My current dev stack consists of Wordpress, NextCloud, BTCPayServer, Jitsi and Mail-in-a-box. Everything is OpenSource and running just fine each one in its own separate KVM VPS.

Objectives: My goal is to be able to deploy the same solutions on K8s in order to be able to scale and gain a bit more flexibility while developing.

Limitations: My budget is limited so I work with KVM VPS in small hosting providers (no AWS/GCE/Azure/DO/etc).

Current K8S setup is 1 Domain with 1 Master + 2 Workers: - Master 1: 2xCPU, 2gb RAM, 50gb SSD, Master01_IP - Worker 1: 1xCPU, 1gb RAM, 10gb SSD, Worker01_IP - Worker 2: 2xCPU, 3gb RAM, 60gb SSD, Worker02_IP

Somehow I managed to get the cluster working, I edited /etc/hosts with all 3 IPs in each server, run the master and then joined the two workers.

Then installed Wordpress by executing:

helm install wordpress-test bitnami/wordpress

I get stuck in EXTERNAL-IP "pending"

$ kubectl get svc --namespace default -w wordpress-test wordpress-test LoadBalancer 10.104.15.90 "pending" 80:32577/TCP,443:31388/TCP 102s terminal-screenshot

How do I expose the deployment EXTERNAL-IP to some of my available IP (1-Master, 2 Workers) so I can get access to it by going to mydomain.xyz?

I've read about LoadBalancers but most documentation makes reference to big cloud providers such as AWS, GCE, Azure, DigitalOcean, all are out of my scope since I don't even have a credit card to register and make an account.

I need to be able to learn how to deploy it with my own resources so here I'm asking for some help :)

Upvotes: 0

Views: 485

Answers (1)

Arghya Sadhu
Arghya Sadhu

Reputation: 44697

  1. You can deploy an ingress controller such as nginx and expose the ingress controller via NodePort.Then use an ingress resource to expose the service via the nginx.

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: rewrite
  namespace: default
spec:
  rules:
  - host: mydomain.xyz
    http:
      paths:
      - backend:
          serviceName: coffee-svc
          servicePort: 80

Since the domain mydomain.xyz is not a real domain registered with a DNS provider you could just modify the /etc/hosts file of the system from where you would access it to have the mydomain.xyz to NodeIP mapping.

  1. Another option would be to use metalLB which is an implementation of LoadBalancer for bare metal without a cloud provider.

Upvotes: 1

Related Questions