Hello good people,
i am currently learning OpenShift and have here and there some trouble to understand the logic bahind some commands and their behaviour, here are some examples:
oc help
Why is oc set resources --help or other subcommand --help command output is build in opposite direction. Typical man page for an example has section from top to bottom:
Name
Synopsis
description with options
examples with commands and options
but oc set resources --help is build like
Description
Examples
Options
Usage
I need to scroll up every time if want to see examples. As a user i want to see the examples at the bottom of the output without a need to scrolling up.
---
Group management
oc adm groups new group-name, but in order to delete it, i have to use:
oc delete group group-name
why is the deletion command missing in oc adm groups , like oc adm groups delete group-name, for example?
---
Quotas and Limitranges
Why is it possible to create a quota over the cli with:
oc create quota quota-name
but there is no oc command to create a limitrange, like oc create limitrange?
it is only possible to create a limitrange over the web ui or a yaml file
---
As a user i want to build a a quota in a yaml format. But how can i build it without knowing the options, its entries and the yaml structure? You would say, look in to the documentation or use oc explain, but for an example oc explain quota.spec.hard shows a lot of information about value types and other information, but where are
spec:
hard:
pods:
requests.cpu
and so on.
Why not to put in oc explain real yaml examples to provide really useful information rather then describing values types and so on. If i want to create a quota yaml file, the oc explain is useless.
---
Web-UI creation examples
Why there are in the web ui under Administration - ResourceQuotas - Create Quota examples available but not examples under Administration - LimitRanges - Create LimitRange creation form?
---
oc get events
why there is no built-in alias for oc get events --sort-by=.metadata.creationTimestamp or this sorting not enabled by default?
---
Creation of project templates
in order to create a project template, i need to create a temporary namespace, then
run oc adm create-bootstrap-project-template -o yaml > my_template_file.yaml
create quota with oc command
create limitranges with web ui, because more easier to use.
oc get quotas,limitranges -o yaml >> my_template_file.yaml
remove manually timestamps, uids, statuses, versions and moving parameters to the bottom of the file. And after all that, the setting up projects.config.openshift.io cluster object to provide my template there.
Are you kidding me? Why not just to provide all the available options and settings needed for the template with one single command like oc adm create-bootstrap-project-template and the user can just delete the blocks that are not needed. Or provide additional options while executing oc adm create-bootstrap-project-template to add quotas, limitranges blocks to the template with all the possible entries.
Why it feels more like a workaround rather then production ready solution during this whole process?
Why there is no such option to create a project template in the web ui?
---
creating new projects
oc new-project project-name
but oc delete project project-name
why not just to use the same syntax to create a project like oc create project?
---
As a user that is learning OpenShift from scratch, some of the decisions or ways to handle daily tasks, feels more like a work around rather then finished product. I am already working with Red Hat products since several years but never had such a hard experience to learn to use a new software like OpenShift.
Mayby some of you had a similar experience and could share some tipps how to handle those tasks, specially of creating project templates.
Greets,
Denis
Hello @MKLegion ! Your feedback is about RHOCP as a product and not for the course as I see.
I understand your observations regarding the usage and behavior of certain OpenShift commands. These design choices, while sometimes appearing inconsistent, are often rooted in the platform's underlying architecture and operational philosophies.
Regarding the oc help command structure, its primary aim is to offer immediate practical assistance by listing examples first, enabling users to quickly grasp common usage patterns. For more comprehensive, detailed documentation on any specific command's parameters and structure, oc explain <command> is the intended tool.
When it comes to group management, you use oc adm groups for creation and other administrative tasks, reflecting its role in high-level cluster administration. However, deleting a group falls under the general resource management umbrella, hence you utilize the standard oc delete group command, consistent with deleting other OpenShift resources.
Similarly, the distinction between quotas and limit ranges in command-line creation stems from their complexity. While you can directly oc create quota, there isn't a parallel oc create limitrange command. Limit ranges often demand more intricate configurations that are typically best managed via declarative YAML files or through the intuitive web user interface. If you're building a quota definition in YAML, oc explain quota.spec.hard is the appropriate command to understand the required structure and permissible value types, even if it doesn't provide a direct, full YAML example. This complexity also explains why web UI creation examples are provided for quotas but not always for limit ranges.
For oc get events sorting, there isn't a built-in alias to sort by creation timestamp directly. To achieve this, you need to pipe the command's output to something like sort -k .metadata.creationTimestamp ( not sure, didnt try this yet ).
Finally, the process for creating project templates can appear cumbersome due to the extensive customization and flexibility they offer, allowing for highly detailed and repeatable project setups. If this complexity becomes a hindrance, simplifying your requirements or leveraging existing templates might be more efficient. The differentiation between oc new-project for creation and oc delete project for removal is due to the distinct nature of these operations; creating involves setting up an entirely new namespace and associated resources, while deleting is a straightforward removal of an existing one.
Ultimately, OpenShift's power and flexibility can introduce an initial learning curve. As you continue to work with the platform, these patterns and workflows will likely become more intuitive. Should you encounter persistent challenges, remember that the vibrant OpenShift community and Red Hat support are excellent resources for personalized assistance.
https://commons.openshift.org/
1. --help format is reversed
Problem: Examples appear at the top; you have to scroll up.
Why: oc is built differently from traditional man pages.
Fix: Use less or this command to see only examples:
oc set resources --help | awk '/Examples:/, /Options:/'
2. Group deletion is not under oc adm
Problem: Creation uses oc adm groups, but deletion is oc delete group.
Why: oc delete is a standard Kubernetes delete command.
Fix: Use oc delete group <name> — it's expected behavior.
3. No oc create limitrange
Problem: Can't create LimitRange from CLI easily.
Fix: Use YAML file and apply it:
oc apply -f limitrange.yaml
4. oc explain is not helpful
Problem: It shows schema, not real examples.
Fix: Use:
oc create quota myquota --hard=pods=10 --dry-run=client -o yaml
to generate working YAMLs.
5. Web UI lacks LimitRange examples
Problem: Quota form has examples, LimitRange doesn't.
Fix: from existing namespaces:
oc get limitrange -n <ns> -o yaml
6. oc get events not sorted by time
Fix: Use this alias:
alias ocgevents='oc get events --sort-by=.metadata.creationTimestamp'
7. Project template creation is complex
Problem: Requires temp project, manual YAML cleanup.
Fix: Use:
oc get quota,limitrange -n temp-ns -o yaml > my_template.yaml
Then clean YAML using yq or manually.
8. oc new-project vs oc create project
Why: oc new-project sets up extra configs like RBAC.
Fix: Use either, but prefer oc new-project for full setup.
Tips:
Use --dry-run=client -o yaml to build YAMLs.
Use CLI for consistency, even if UI is easier.
Consider scripting or using Helm for template automation.
Thank you for the helpful tipps, i do appreciate it!
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.