Log into the web console and get familiar with the interface.
Create a new project from the web console called:
userXY-webui
Copy the login command from the web console (did you find this option? -> in the menu on the right hand side).
oc login https://techlab.puzzle.ch:443 --token=XYZ
oc whoami
The token allows you to have a logged in session and can be used to do logins from the cli (on the API), without doing the authentication there.
Once you are logged in let's get familiar with the CLI and its commands.
oc cli features a help output, as well as more detailed help for each command:
oc help
oc projects -h
oc projects
Create a project called userXY-cli
You can get help by
oc new-project -h
solution
oc new-project userXY-cliWe are immediately switched to our project:
oc project
We can inspect our project by either describing it or getting a yaml (or json) formatted output of our created project.
oc describe project userXY-cli
oc get project userXY-webui -o yaml
oc get project userXY-webui -o json
Openshift can have multiple users (also with different roles) on the same projects. For that we can add individual users on the project or we can also add a group of users to a project.
Users or groups can have different roles either within the whole cluster or locally within a project.
Find more about roles here and how to manage them here.
To see all the active roles in your current project you can type:
oc describe rolebinding.rbac
For your webui project:
oc describe rolebinding.rbac -n userXY-webui
We can mange roles by issuing oc adm policy commands:
oc adm policy -h
For this lab there is a group called techlab
, where all workshop users are being part of.
Let's add this group as an admin role to our current project, so we can co-develop things within these projects.
oc adm policy add-role-to-group -h
oc adm policy add-role-to-group admin techlab
Too much privileges? At least for our webui projects, so let's add folks there only as viewer:
oc adm policy add-role-to-group view techlab -n userXY-webui
How many others did add us to their projects? Let's see by get the current list of projects:
oc projects
Check the changes inside the web console. Go to both of your projects and find the techlab group under Resources -> Membership
Everything within Openshift (Kubernetes) is represented as a resource, which we can view and depending on our privileges edit.
You can get all resources of your current project, by typing:
oc get all
You can also get all resources of all namespaces (projects) you have access to:
oc get all --all-namespaces
Take the openshift-web-console project that has some resources to inspect. Click on command, if you did not find the solution how to add the namespace to the command.
command
oc get all -n openshift-web-consoleFound an interesting resource you want to know about it, you can describe/get each one of them:
general command
oc describe resrourceXY resourceName -n openshift-web-consolecommand to inspect a service
oc describe service webconsole -n openshift-web-consoleYou can also edit them:
oc edit resrourceXY resourceName
For example let's edit our webui project.
command
oc edit project userXY-webuiThis was only an example. Do exit the editor by typing: ESC and : and q
Not happy about how things went in your current projects and want to start over?
oc delete project userXY-webui
This will delete all resources bundled by this project. Projects are really an easy way to try things out and once you are done easily clean it up.
You can always get an overview of your current resources by typing:
oc status
This will become handy, once we start deploying more things.