HowTo:CS Launch: Difference between revisions

From Computer Science Wiki
Jump to navigation Jump to search
Carnold (talk | contribs)
No edit summary
Carnold (talk | contribs)
m Protected "HowTo:CS Launch" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
(No difference)

Revision as of 08:35, 6 November 2023

Introduction

This is a quick start guide for using the CS Launch website and kubernetes resources. It will walk you through setting up a basic website with database support. The first half showing using the web interface, and the second half shows how to do it through a command line interface.

Create a New Project

Access to CS Launch is made through projects. A project is a collection of kubernetes namespaces and resources. You can have access to multiple projects. Projects can be shared with other CS members. The default kubernetes cluster Endeavour only allows Faculty and Staff to create projects. After a Faculty member creates a project, it can be shared with CS students.

  • Go to CS Launch website: https://launch.cs.vt.edu
  • Click the login button to use your CS username and password to log in
  • The main screen will show a list of kubernetes clusters you have access to, if the list is blank then you don't have access to any clusters
  • Click on the cluster name where you want to create the new project
  • This is your Cluster Dashboard
  • From the menu on the left Click on Projects/Namespaces
  • Click on the Create Project button
  • Fill in the Name field with a cluster unique name for your project
  • You add additional project members now or later after the project is created
  • Click on the Create button

Create a New Namespace

Kubernetes uses namespaces to separate resources. The CS Launch resources groups namespaces into projects for access control. A project can contain multiple namespaces. At least one namespace is required before resources can be created in a project. To access a namespace you must be a member of the project the namespace is associated with. A namespace can only be associated with a single project.

  • Navigate to the list of projects
    • Click on Projects/Namespaces from the cluster dashboard
  • Click on the Create Namespace button that is associated with the project you want to assign the namespace to
  • Fill in the Name field with a cluster unique name. The namespace name can be the same as the project name as long as it follows the naming rules and is not already in use. Kubernetes namespace names must following DNS name rules: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names
  • Click on the Create button

Launching a Database Using Helm

Kubernetes supports Helm charts to automate deployment of software. There are existing Helm charts for many popular software projects, such as databases. Using a Helm chart can make setting up and updating complex software much easier. This guide will walk you through deploying MariaDB using a Helm chart.

  • Navigate to your Cluster Dashboard
  • Click on Apps from the menu on the left
  • Click on Charts underneath Apps
  • We need to find the MariaDB chart
    • Make sure to select Partners in the first drop down list
    • Select Database from the catagories drop down list
    • Click on the MariaDB tile
  • Click on the Install button
  • Select the namespace from the drop down list where you want the database deployed to
  • Click on the Next button
  • You will be presented with a long list of options and their default values in yaml format
  • For our example, change the following options:
auth:
  database: cslaunch
  username: cslaunch
  password: 'Insecure'
primary:
  persistence:
    size: 1Gi
  • Click on the Install button
  • It will take a minute or two for the deployment to complete. The site will give you a window to watch the progress, and report any errors that might occur.
  • You should now have a running database, but no real way to access it yet
  • Other pods in the same namespace will be able to connect to this database using the hostname mariadb

Launch an App Using a Public Image

Next we will launch a web app called Adminer that will allow us to interact with our running database, and assign it a URL.

  • Navigate to your Cluster Dashboard
  • Click on Workloads from the menu on the left
  • Click on the Create button
  • Select the Deployment tile as this type of deployment is best suited for our Adminer web app
  • Make sure to select the same namespace as the database
  • Fill in Name with a project unique name. The name must following DNS naming rules.
  • Fill in Container Image with the value adminer:latest This is a path to a docker image, and it resolves to the latest image from the adminer project on https://docker.io.
  • The rest of the options can be left on their default settings
  • Click on the Create button
  • The web app will start running, but we won't have a way to access it until we map a URL to the container, this is called an ingress in kubernetes

Create Ingress to a Workload