11 software delivery problems solved by intelligence software delivery platform  Download
Select Page

OES installation on K3s using Ubuntu EC2 instance

Arjun P November 12, 2020
Share

What is K3s?

K3s is a light-weight Kubernetes cluster designed to be a single binary of less than 40MB that completely implements the Kubernetes API. Due to its low resource requirements, it’s possible to run a cluster on anything from 512MB of RAM machines upwards. Find more information here.

Prerequisites:

  1. EC2 instance with at least 6 core and 20 GB memory (For running OES)

  2. Helm 3 is setup and initialized in your instance. If the helm is not set up, follow https://helm.sh/docs/intro/install/ to install helm.

Steps:

  1. To install k3s, switch to the root user, and execute the following commands.

    curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="- -write-kubeconfig=/home/ubuntu/.kube/config - -write-kubeconfig-mode=644" sh -

    By default Kubernetes, the config file will be written to the root user. To write to the Ubuntu user use the – -write-kubeconfig option. Find all the available installation options here

  2. Create a namespace and make it as default

    kubectl create namespace oes

    kubectl config set-context - -current - -namespace oes

  3. Add opsmx helm repo to your instance (as ubuntu user)

    helm repo add opsmx https://helmcharts.opsmx.com/

  4. Install Helm chart to the namespace created above using the helm repo as added above.

    helm install <RELEASE_NAME> opsmx/oes --set
    imageCredentials.username=<DOCKER_ID> --set
    imageCredentials.password=<DOCKER_PASSWORD> --set
    k8sServiceType=NodePort --timeout 15m

    Available installation modes are:

    • OES-AP (both OES and Autopilot), 

    • OES (Only OES), 

    • AP (Only Autopilot), 

    • None(Skip OES installation) 

    By default, OES-AP gets installed if we are not specifying the installation mode. For more information please visit: https://github.com/OpsMx/enterprise-spinnaker/tree/master/charts/oes

    Note: In the above command RELEASE_NAME is the name that you want to give to the particular installation. If you do not wish to specify a release name, pass –generate-name while running the helm install command. Find more details here.

  5. Edit the Configmaps of oes-ui and oes-gate

    OES installation will work off self without any manual intervention on cloud-managed Kubernetes clusters where load balancers will be assigned to oes-ui and oes-gate services. 

    In this case, the private IP of the instance will be assigned to the oes-ui and oes-gate services. So to get the oes-ui access through the browser it is required to edit the configmap of oes-ui and oes-gate as follows.

    In oes-ui-config, replace OES_GATE_IP with the IP of the node (Typically it is the VM IP when it is a single node k8s cluster. In this case, it is the public IP of ec2 instance). 

    In oes-gate-config, replace OES_UI_LOADBALANCER_IP with the IP(public IP) of the instance.

  6. After making the above changes to configmaps, restart oes-gate and oes-ui pods by running the following command

    kubectl rollout restart deploy oes-ui oes-gate

  7. Once all pods are in a ready state, access oes-ui using the URL as given below.

    http://<public-ip of instance>:<OES-ui-Nodeport>

    OES-ui-Nodeport can be fetched by running the following command.

    kubectl get svc oes-ui -o jsonpath="{.spec.ports[].nodePort}"

  8. Login to OES using default credentials


    Username: admin

    Password: opsmxadmin123

  9. To add worker nodes to the k3s cluster (If required), execute the following commands in the worker node.

      export K3S_URL=https://<master-private-ip>:6443

export K3S_TOKEN=<paste-the-token-stored-in-master-node>

curl -sfL https://get.k3s.io | sh -

      Token can be found in the location : /var/lib/rancher/k3s/server

Iocn

Arjun P

Arjun has around 4 years of experience in the IT industry. He has worked as a Linux administrator and DevOps engineer. in Wipro Limited. Arjun is an expert in Linux, AWS, Azure, Docker, Kubernetes, Terraform etc. Linkedin: www.linkedin.com/in/arjun-p-766093132

You May Like