Deploying Kubernetes on MetalSoft#

MetalSoft provides a built-in mechanism to deploy and expand a single-tenant kubernetes (upstream open source version) application in an infrastructure.

Note that Kubernetes deployment must be enabled by the admin in the user limits before it is available to users.

The Kubernetes cluster is deployed using Calico and Ceph as an option for PVCs. Other options include using the CSI providers for the storage systems managed by MetalSoft.

Deploying Kubernetes using the UI:#

Click on the Kubernetes icon on the left

Configure the node server types and count#

Click on one of the two instance arrays.

Go to the Configuration tab and select the configuration and count for both the Head and the Worker nodes:

Click on the “-” to remove the currently selected option and click Add New and select a configuration that is available.

Click “Deploy”.

Accessing the cluster#

To access the cluster either connect via SSH on the first node or use the kubectl configuration file provided in the interface to connect from outside the cluster.

Setting up a sample application on Kubernetes#

  1. Setting up the initial application

    In this example, the application and service are in a single file. This is based on ASP.NET samples container To set up your initial application, connect to the Master node by SSH as described in the previous section and accept the security warning. Create a directory structure to keep your configuration files in. For this example, we will use /app/ for the application

    Create the file to store the configuration in:

    vim kubernetes-sample.yaml

And copy the following into the file and save it

kind: Service
apiVersion: v1
  name: dotnet-service
    app: dotnet
  - protocol: TCP
    port: 80
    targetPort: 80
apiVersion: apps/v1
kind: Deployment
  name: dotnet-deployment
    app: dotnet
  replicas: 2
      app: dotnet
        app: dotnet
      - name: dotnet
        - containerPort: 80

Lastly, you need to use kubectl to create the app and service:

kubectl create -f kubernetes-sample.yaml

You should receive the following output:

[root@instance-60451 apps]# kubectl create -f kubernetes-sample.yaml
service/dotnet-service created
deployment.apps/dotnet-deployment created
  1. Setting up the ingress controller

    Next we need to expose the application to the internet using an Ingress controller.

    Create the file to store the configuration in:

    vim kubernetes-sample-ingress.yaml

And copy the following into the file and save it:

kind: Ingress
  name: asp-ingress
  annotations: /
  - http:
        - path: /
          pathType: Prefix
                name: dotnet-service
                 number: 80

Lastly, you need to use kubectl to create the app and service:

kubectl create -f kubernetes-sample-ingress.yaml
  1. Verifying the application and controller are set up.

    If you run:

    kubectl get services --all-namespaces

    You should get an output similar to this:

    NAMESPACE              NAME                                 TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
    default                dotnet-service                       ClusterIP    <none>        80/TCP                       4m20s
    default                kubernetes                           ClusterIP        <none>        443/TCP                      3h52m
    ingress-nginx          ingress-nginx-controller             LoadBalancer   80:30972/TCP,443:31184/TCP   3h50m
    ingress-nginx          ingress-nginx-controller-admission   ClusterIP   <none>        443/TCP                      3h50m
    ingress-nginx          ingress-nginx-defaultbackend         ClusterIP   <none>        80/TCP                       3h50m
    kube-system            kube-dns                             ClusterIP       <none>        53/UDP,53/TCP,9153/TCP       3h52m
    kubernetes-dashboard   dashboard-metrics-scraper            ClusterIP   <none>        8000/TCP                     3h49m
    kubernetes-dashboard   kubernetes-dashboard                 NodePort     <none>        443:31708/TCP                3h49m

    You should be able to see that the EXTERNAL-IP is set for the Load Balancer ingress-nginx-controller. In this instance

    If you now go back to the infrastructure manager and add a firewall rule to allow port 80, you should be able to view the application in a web browser.

    You will also be able to view the details in the dashboard which you can acces from the infrastruture editor after clicking on one of the Instance Arrays (Kubernetes/Dashboard):

Deploying RedHat OpenShift, Rancher or other distributions of Kubernetes on MetalSoft#

Other versions of kubernetes can be deployed after the bare metal servers have been deployed. Follow the instructions for the respective distributions for more details:

MetalSoft automatic DNS management#

MetalSoft provides built-in DNS records for each for WAN IPs provisioned.

For example will be mapped to the ip

$ dig

; <<>> DiG 9.10.6 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 48397
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 512
; IN A

;; AUTHORITY SECTION: 300  IN      SOA alex.bordei\ 1684800083 300 600 86400 1200

;; Query time: 381 msec
;; WHEN: Tue Nov 07 12:13:19 CET 2023
;; MSG SIZE  rcvd: 144

If additional DNS records are required an external DNS system might be needed to set CNAME records towards the records managed by MetalSoft.