Skip to content

Authentication, new project and basics

inscription

Objective

Learn how to authenticate, create new projects, and some basic commands in Openshift. Enter the Openshift Castle.

Prerequisites

To embark on this adventure, you'll need:

  • Access to an Openshift cluster or a terminal emulator connected to one.
  • Basic familiarity with command-line interfaces (CLI) and Kubernetes concepts.

Introduction

In the vast landscape of the digital realm, where clusters of containers flourish like bustling kingdoms, there lies the imposing fortress of Openshift. Built upon the foundation of Kubernetes, this castle stands as a bastion of security and scalability, protecting its treasures with unwavering vigilance.

Our hero, a brave adventurer seeking knowledge and mastery, stands before the gates of Openshift. The castle looms above, its architecture intricate and imposing, a testament to the power it holds within.

Authentication Gates

Before venturing forth, our hero must authenticate at the castle gates. With the oc login command, he present their credentials:

oc login <cluster-url>

Forging New Projects

A strange sensation courses through our hero's veins as they enter the castle, as if the fortress were under their command. The first thing noticed is the multitude of different wings within the castle, each isolated from the others. With newfound powers, our hero invokes the creation of a new project to carve out a new realm:

oc new project <my-app>

Commanding the Castle

Adorning the walls are inscriptions in a mysterious language. Armed with the knowledge of oc commands, our hero delves deeper into the castle's inner workings:

oc cluster-info
oc api-versions
oc get clusteroperator
oc get pod
oc get pod <pod_name>
oc get pod <pod_name> -o yaml
oc get pod <pod_name> -o json
oc get deploy <deploy_name> -o wide
oc get all
oc describe <resource_type> <resource_name>
oc explain <jsonpath_identifier>
oc explain <jsonpath_identifier> --recursive
oc create -f <pod.yaml>
oc status --suggest
oc delete <resource_type> <resource_name>
For instance:
oc explain pods.spec.containers.resources
These commands unveil the secrets of the castle's infrastructure and its inhabitants.

To make these commands influence a different wing of the castle, than the one where he is in that moment, our hero needs to add the option --namespace or -n to the instruction:

oc get pod -n <namespace>

Token of Entry - OAuth

For those who seek passage via OAuth, the castle offers tokens of entry:

oc login --token=sha256-BW...fE2 --server=https://api.eg.vitrua.top:6443
These tokens grant access to the castle's inner sanctums.

Conclusion

And thus, the hero took his first steps inside the castle.