OES installation on K3s using Ubuntu EC2 instance
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:
- EC2 instance with at least 6 core and 20 GB memory (For running OES)
- 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:
- 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.
- Create a namespace and make it as default
kubectl create namespace oes
kubectl config set-context - -current - -namespace oes
- Add opsmx helm repo to your instance (as ubuntu user)
helm repo add opsmx
https://helmcharts.opsmx.com/
- 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.
- 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.
- 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
- 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}"
- Login to OES using default credentials
Username: adminPassword: opsmxadmin123
- 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