Hulleman.io

EX280 (DO180 + DO280) EXAM TOOL SHEET

This document contains CLI tools to help you pass the exam.

1. Configure your editor for YAML

On the exam you will work a lot with vi or vim. By default vi handles YAML poorly (tabs vs spaces). If you accidentally use a TAB instead of spaces, your whole file can break.

Run this command at the start of your exam:

echo "set ts=2 sw=2 expandtab" >> ~/.vimrc
source ~/.vimrc

What does this do?

2. Looking for an OBJECT?

You know the word “Route” or “User” or “Volume”, but not the exact resource name. Use:

oc api-resources | grep -i volume

Output:

NAME                     SHORTNAMES   APIGROUP                  NAMESPACED   KIND
persistentvolumeclaims   pvc                                    true         PersistentVolumeClaim
persistentvolumes        pv                                     false        PersistentVolume
volumesnapshots          vs           snapshot.storage.k8s.io   true         VolumeSnapshot
volumesnapshotclasses                 snapshot.storage.k8s.io   false        VolumeSnapshotClass

3. Looking for an ACTION? (Command)

You want to do something, for example “import”, “label” or “scale”. Use:

oc help | grep -i image

Output:

image             Manage images
registry          Manage the integrated registry
tag               Tag existing images into image streams
import-image      Import images from a container registry

4. Show examples

Almost every oc command has an Examples section at the bottom of the help text. Because the help text is often long, you may not see it immediately. You can use grep to jump directly to those examples.

Use the -A (After) flag of grep.

The command:

oc <command> --help | grep -A 10 Examples

4.1 You don’t know how to create a user

oc create user -h | grep -A 5 Examples

Output:

Examples:
    # Create a user with the name 'my-user'
    oc create user my-user

    # Create a user with the name 'my-user' and the full name 'My User'
    oc create user my-user --full-name="My User"

4.2 You must create a secure route

You’re assigned: “Create a secure Route for service ‘frontend’ with edge termination. Use the certificates in /tmp/certs.”

You never know exactly whether the flag is --certificate, --cert, --tls-cert or something else.

oc create route edge --help | grep -A 10 Examples

Output:

Examples:
    # Create an edge route named 'my-route' that exposes service 'frontend'
    oc create route edge my-route --service=frontend

    # Create an edge route that exposes service 'frontend' with a hostname and specific certificates
    oc create route edge --service=frontend --cert=tls.crt --key=tls.key --ca-cert=ca.crt --hostname=www.example.com

5. The “Quick-delete” Trick

Sometimes you make a mistake and need to delete a pod or deployment. OpenShift waits 30 seconds (“grace period”) before something is actually removed. On an exam that feels eternal.

Use these flags to kill something immediately:

oc delete pod <podname> --force --grace-period=0

6. The “Variable” Trick (Less typing)

You often have to type --dry-run=client -o yaml to generate templates. It’s tedious to type each time.

At the start of your exam you can set a variable in your shell (or an alias).

Run this at the beginning:

export yaml="--dry-run=client -o yaml"

How to use it:

oc create service clusterip my-svc --tcp=80 $yaml

The shell will automatically replace it with the long text.

##. 7. Use the GUI to generate Network Polcies