Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save lpsantil/16ff1f5672382674b81d74a830c9e727 to your computer and use it in GitHub Desktop.

Select an option

Save lpsantil/16ff1f5672382674b81d74a830c9e727 to your computer and use it in GitHub Desktop.

Revisions

  1. @rafaeltuelho rafaeltuelho revised this gist Aug 9, 2017. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,16 @@ oc start-build ola2 --from-file=./target/ola.jar --follow
    oc new-app
    ```

    * Turn off/on DC triggers to do a batch of changes without spam many deployments
    ```
    oc rollout pause dc <dc name>
    oc rollout resume dc <dc name>
    ```
    * get a route URL using OC
    ```
    http://$(oc get route nexus3 --template='{{ .spec.host }}')
    ```

    * Using Nexus repo manager to store deployment artifacts
    Maven uses settings.xml in $HOME/.m2 for configuration outside of pom.xml:

  2. @rafaeltuelho rafaeltuelho revised this gist Aug 9, 2017. 1 changed file with 39 additions and 0 deletions.
    39 changes: 39 additions & 0 deletions openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,43 @@

    * Binary Builds
    ```
    oc new-build --binary=true --name=ola2 --image-stream=redhat-openjdk18-openshift
    oc start-build ola2 --from-file=./target/ola.jar --follow
    oc new-app
    ```

    * Using Nexus repo manager to store deployment artifacts
    Maven uses settings.xml in $HOME/.m2 for configuration outside of pom.xml:

    ```
    <?xml version="1.0"?>
    <settings>
    <mirrors>
    <mirror>
    <id>Nexus</id>
    <name>Nexus Public Mirror</name>
    <url>http://nexus-opentlc-shared.cloudapps.na.openshift.opentlc.com/content/groups/public/</url>
    <mirrorOf>*</mirrorOf>
    </mirror>
    </mirrors>
    <servers>
    <server>
    <id>nexus</id>
    <username>admin</username>
    <password>admin123</password>
    </server>
    </servers>
    </settings>
    ```

    Maven can automatically store artifacts using -DaltDeploymentRepository parameter for deploy task:

    ```
    mvn deploy -DskipTests=true \
    -DaltDeploymentRepository= nexus::default::http://nexus3.nexus.svc.cluster.local:8081/repository/releases
    ```

    * to update a DeploymentConfig in order to change the Docker Image used bythe POD's container
    ```
    oc project <project>
  3. @rafaeltuelho rafaeltuelho revised this gist Aug 9, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,12 @@ OC_EDITOR="vim" oc edit dc/<your_dc>
    ```

    * BuildConfig with Source pull secrets
    ```
    oc secrets new-basicauth gogs-basicauth --username=<your gogs login> --password=<gogs pwd>
    oc set build-secret --source bc/tasks gogs-basicauth
    ```

    * Create a configmap file and mount as a volume on DC
    ```
    oc create configmap myconfigfile --from-file=./configfile.txt
  4. @rafaeltuelho rafaeltuelho revised this gist Aug 8, 2017. 1 changed file with 16 additions and 1 deletion.
    17 changes: 16 additions & 1 deletion openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,20 @@ OC_EDITOR="vim" oc edit dc/<your_dc>
    imagePullPolicy: Always
    ```

    * Create a configmap file and mount as a volume on DC
    ```
    oc create configmap myconfigfile --from-file=./configfile.txt
    oc set volumes dc/printenv --add --overwrite=true --name=config-volume --mount-path=/data -t configmap --configmap-name=myconfigfile
    ```

    * create a secret via CLI
    ```
    oc create secret generic mysec --from-literal=app_user=superuser --from-literal=app_password=topsecret
    oc env dc/printenv --from=secret/mysec
    oc set volume dc/printenv --add --name=db-config-volume --mount-path=/dbconfig --secret-name=printenv-db-secret
    ```

    * Configure Liveness/Readiness probes on DCs
    ```
    oc set probe dc cotd1 --liveness -- echo ok
    @@ -472,7 +486,8 @@ $ oc export -o json
    -n openshift mysql-ephemeral > mysql-ephemeral.json
    ... change the mysql-ephemeral.json file ...
    $ oc process -f mysql-ephemeral.json \
    -v MYSQL_DATABASE=testdb,MYSQL_USE=testuser,MYSQL_PASSWORD=secret > testdb.json
    -v MYSQL_DATABASE=testdb,MYSQL_USE=testuser,MYSQL_PASSWORD=
    > testdb.json
    $ oc create -f testdb.json
    ```

  5. @rafaeltuelho rafaeltuelho revised this gist Aug 8, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -38,6 +38,7 @@ oc run pi --image=perl --schedule='*/1 * * * *' \

    ```
    oc expose service cotd1 --name='abcotd' -l name='cotd'
    oc set route-backends abcotd --adjust cotd2=+20%
    oc set route-backends abcotd cotd1=50 cotd2=50
    ```

  6. @rafaeltuelho rafaeltuelho revised this gist Aug 7, 2017. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,18 @@ OC_EDITOR="vim" oc edit dc/<your_dc>
    oc set probe dc cotd1 --liveness -- echo ok
    oc set probe dc/cotd1 --readiness --get-url=http://:8080/index.php --initial-delay-seconds=2
    ```
    * Create a new JOB
    ```
    oc run pi --image=perl --replicas=1 --restart=OnFailure \
    --command -- perl -Mbignum=bpi -wle 'print bpi(2000)'
    ```

    * CRON JOB
    ```
    oc run pi --image=perl --schedule='*/1 * * * *' \
    --restart=OnFailure --labels parent="cronjobpi" \
    --command -- perl -Mbignum=bpi -wle 'print bpi(2000)'
    ```

    * A/B Deployments - Split route trafic between services

  7. @rafaeltuelho rafaeltuelho revised this gist Aug 7, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,12 @@ OC_EDITOR="vim" oc edit dc/<your_dc>
    imagePullPolicy: Always
    ```
    * Configure Liveness/Readiness probes on DCs
    ```
    oc set probe dc cotd1 --liveness -- echo ok
    oc set probe dc/cotd1 --readiness --get-url=http://:8080/index.php --initial-delay-seconds=2
    ```


    * A/B Deployments - Split route trafic between services

  8. @rafaeltuelho rafaeltuelho revised this gist Aug 7, 2017. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,13 @@ OC_EDITOR="vim" oc edit dc/<your_dc>
    ```

    * A/B Deployments - Split route trafic between services

    ```
    oc expose service cotd1 --name='abcotd' -l name='cotd'
    oc set route-backends abcotd cotd1=50 cotd2=50
    ```

    * to pull an image directly from red hat offcial docker registry
    ```
    docker pull registry.access.redhat.com/jboss-eap-6/eap64-openshift
  9. @rafaeltuelho rafaeltuelho revised this gist Aug 6, 2017. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -438,4 +438,17 @@ oc new-app -o json openshift/hello-openshift > hello.json
    * to list all parameters from mysql-persistent template:
    ```
    $ oc process --parameters=true -n openshift mysql-persistent
    ```
    ```
    * Customizing resources from a preexisting Template

    Example:
    ```
    $ oc export -o json
    -n openshift mysql-ephemeral > mysql-ephemeral.json
    ... change the mysql-ephemeral.json file ...
    $ oc process -f mysql-ephemeral.json \
    -v MYSQL_DATABASE=testdb,MYSQL_USE=testuser,MYSQL_PASSWORD=secret > testdb.json
    $ oc create -f testdb.json
    ```

    > oc process uses the -v option to provide parameter values, while oc new-app command uses the -p option.
  10. @rafaeltuelho rafaeltuelho renamed this gist Aug 6, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion osev3-common-cli.md → openshift-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -432,4 +432,10 @@ oc new-app -o json openshift/hello-openshift > hello.json
    * Make two changes to metadata object:
    * Add name attribute and value so template has name users can refer to
    * Add annotations containing description attribute for template, so users know what template is supposed to do.
    * Rename items array attribute as objects
    * Rename items array attribute as objects

    ## Working with Templates
    * to list all parameters from mysql-persistent template:
    ```
    $ oc process --parameters=true -n openshift mysql-persistent
    ```
  11. @rafaeltuelho rafaeltuelho revised this gist Aug 6, 2017. 1 changed file with 23 additions and 1 deletion.
    24 changes: 23 additions & 1 deletion osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -410,4 +410,26 @@ Examine the first entry in the log file:

    ```
    Service account has sufficient permissions to view pods in kubernetes (HTTP 200). Clustering will be available.
    ```
    ```

    ## Creating a new Template
    * Common strategy for building template definitions:
    * Use oc new-app and oc expose to manually create resources application needs
    * Test to make sure resources work as expected
    * Use oc export with -o json option to export existing resource definitions
    * Merge resource definitions into template definition file
    * Add parameters
    * Test resource definition in another project
    > JSON syntax errors are not easy to identify, and OpenShift is sensitive to them, refusing JSON files that most browsers would accept as valid. Use jsonlint -s from the python-demjson package, available from EPEL, to identify syntax issues in a JSON resource definition file.
    * Use `oc new-app` with `-o json` option to bootstrap your new template definition file
    ```
    oc new-app -o json openshift/hello-openshift > hello.json
    ```

    * Converting the Resource Definition to a Template
    * Change kind attribute from List to Template
    * Make two changes to metadata object:
    * Add name attribute and value so template has name users can refer to
    * Add annotations containing description attribute for template, so users know what template is supposed to do.
    * Rename items array attribute as objects
  12. @rafaeltuelho rafaeltuelho revised this gist Aug 5, 2017. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -396,4 +396,18 @@ $ sudo -i systemctl restart atomic-openshift-master.service
    In node machine, to provide filtered information:
    ```
    # journalctl -f -u atomic-openshift-node
    ```

    * Enable EAP clustering/replication

    Make sure that your default service account has sufficient privileges to communicate with the Kubernetes REST API.
    Add the view role to serviceaccount for the project:

    ```
    $ oc policy add-role-to-user view system:serviceaccount:$(oc project -q):default
    ```
    Examine the first entry in the log file:

    ```
    Service account has sufficient permissions to view pods in kubernetes (HTTP 200). Clustering will be available.
    ```
  13. @rafaeltuelho rafaeltuelho revised this gist Aug 5, 2017. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -378,4 +378,22 @@ oc rsync devpod1234:/src /home/user/source
    > "he only caveat to this, is that if we are using the multi-tenant OVS networking plugin, our cluster administrators will have to make visible our ci project to all other projects:" Ref: https://blog.openshift.com/improving-build-time-java-builds-openshift/
    ```
    $ oadm pod-network make-projects-global ci
    ```

    * Adjust Master Log Level
    To adjust openshift-master log level, edit following line of `/etc/sysconfig/atomic-openshift-master` from master VM:

    ```
    OPTIONS=--loglevel=4
    ```

    To make changes valid, restart atomic-openshift-master service:

    ```
    $ sudo -i systemctl restart atomic-openshift-master.service
    ```

    In node machine, to provide filtered information:
    ```
    # journalctl -f -u atomic-openshift-node
    ```
  14. @rafaeltuelho rafaeltuelho revised this gist Jun 18, 2017. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,22 @@

    * to update a DeploymentConfig in order to change the Docker Image used bythe POD's container
    ```
    oc project <project>
    oc get is
    oc import-image <image name> --from=docker.io/<imagerepo>/<imagename> --all --confirm
    oc get istag
    OC_EDITOR="vim" oc edit dc/<your_dc>
    spec:
    containers:
    - image: docker.io/openshiftdemos/gogs@sha256:<the new image digest from Image Stream>
    imagePullPolicy: Always
    ```

    * to pull an image directly from red hat offcial docker registry
    ```
    docker pull registry.access.redhat.com/jboss-eap-6/eap64-openshift
  15. @rafaeltuelho rafaeltuelho revised this gist Jan 25, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,11 @@
    docker pull registry.access.redhat.com/jboss-eap-6/eap64-openshift
    ```

    * to validate a openshift/kubernates resource definition (json/yaml file) in order to find malformed/sintax problems
    ```
    oc create --dry-run --validate -f openshift/template/tomcat6-docker-buildconfig.yaml
    ```

    * to prune old objects
    * https://docs.openshift.com/container-platform/3.3/admin_guide/pruning_resources.html

  16. @rafaeltuelho rafaeltuelho revised this gist Jan 9, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,12 @@
    docker pull registry.access.redhat.com/jboss-eap-6/eap64-openshift
    ```

    * to prune old objects
    * https://docs.openshift.com/container-platform/3.3/admin_guide/pruning_resources.html

    * to enable cluster GC
    * https://docs.openshift.com/container-platform/3.3/admin_guide/garbage_collection.html

    * to get ther current user Barear Auth Token

    ```
  17. @rafaeltuelho rafaeltuelho revised this gist Jan 6, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -41,6 +41,11 @@ oadm policy add-role-to-user <role> <username>
    oadm policy add-cluster-role-to-user <role> <username>
    ```

    * add privileged role to ruan a docker image with root user inside openshift
    ```
    oadm policy add-scc-to-user anyuid -z default
    ```

    > for more details consult: https://docs.openshift.com/enterprise/3.1/admin_guide/manage_authorization_policy.html
    * to test a POD service locally
  18. @rafaeltuelho rafaeltuelho revised this gist Jul 14, 2016. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -312,6 +312,16 @@ oc new-app app-from-custom-docker-build -l app=app-from-custom-docker-build
    oc expose service app-from-custom-docker-build
    ```

    * to copy files to/from a POD

    ```
    #Ref: https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html
    oc rsync /home/user/source devpod1234:/src
    oc rsync devpod1234:/src /home/user/source
    ```

    ## Cluster nodes CleanUp

    1. Desliga todos os containers que vc não tá usando no seu ambiente do openshift
  19. @rafaeltuelho rafaeltuelho revised this gist Jul 14, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,9 @@ oc whoami -t

    ```
    curl -k -H "Authorization: Bearer <api_token>" https://<master_host>:8443/api/v1/namespaces/<projcet_name>/pods/https:<pod_name>:8778/proxy/jolokia/
    # get pod memory via jmx
    curl -k -H "Authorization: Bearer <api_token>" https://<master_host>:8443/api/v1/namespaces/<projcet_name>/pods/https:<pod_name>:8778/proxy/jolokia//read/java.lang:type\=Memory/HeapMemoryUsage | jq .
    ```

    * to login via CLI `oc`
  20. @rafaeltuelho rafaeltuelho revised this gist Jul 14, 2016. 1 changed file with 36 additions and 1 deletion.
    37 changes: 36 additions & 1 deletion osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,18 @@
    docker pull registry.access.redhat.com/jboss-eap-6/eap64-openshift
    ```

    * to get ther current user Barear Auth Token

    ```
    oc whoami -t
    ```

    * to test the OSE Master API

    ```
    curl -k -H "Authorization: Bearer <api_token>" https://<master_host>:8443/api/v1/namespaces/<projcet_name>/pods/https:<pod_name>:8778/proxy/jolokia/
    ```

    * to login via CLI `oc`
    ```
    oc login --username=tuelho --insecure-skip-tls-verify --server=https://master00-${guid}.oslab.opentlc.com:8443
    @@ -61,10 +73,18 @@ oc volume dc/docker-registry \
    --name=registry-storage
    ```
    * Docker builder app creation

    ```
    oc new-app --docker-image=openshift/hello-openshift:v1.0.6 -l "todelete=yes"
    ```
    * STI app creation
    * To create an app using a template (`eap64-basic-s2i`): Ticketmonster demo

    ```
    oc new-app javaee6-demo
    oc new-app --template=eap64-basic-s2i -p=APPLICATION_NAME=ticketmonster,SOURCE_REPOSITORY_URL=https://github.com/jboss-developer/ticket-monster,SOURCE_REPOSITORY_REF=2.7.0.Final,CONTEXT_DIR=demo
    ```

    * STI app creation

    ```
    oc new-app https://github.com/openshift/sinatra-example -l "todelete=yes"
    @@ -274,6 +294,21 @@ oadm registry --service-account=registry \
    oc export all --as-template=<template_name>
    ```

    * to create a build from a Dockerfile

    ```
    # create the build
    cat ./path/to/your/Dockerfile | oc new-build --name=build-from-docker --binary --strategy=docker -l app=app-from-custom-docker-build -D -
    #if you need to give some input to your Docker Build process
    oc start-build build-from-docker --from-dir=. --follow
    # create an OSE app from the docker build image
    oc new-app app-from-custom-docker-build -l app=app-from-custom-docker-build
    oc expose service app-from-custom-docker-build
    ```

    ## Cluster nodes CleanUp

    1. Desliga todos os containers que vc não tá usando no seu ambiente do openshift
  21. @rafaeltuelho rafaeltuelho revised this gist May 27, 2016. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,9 @@

    * to pull an image directly from red hat offcial docker registry
    ```
    docker pull registry.access.redhat.com/jboss-eap-6/eap64-openshift
    ```

    * to login via CLI `oc`
    ```
    oc login --username=tuelho --insecure-skip-tls-verify --server=https://master00-${guid}.oslab.opentlc.com:8443
  22. @rafaeltuelho rafaeltuelho revised this gist May 16, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -286,4 +286,9 @@ oc export all --as-template=<template_name>
    --------------- | ----------------------------------------------
    Default | <pod_namespace>.cluster.local
    Services | <service>.<pod_namespace>.svc.cluster.local
    Endpoints | <name>.<namespace>.endpoints.cluster.local
    Endpoints | <name>.<namespace>.endpoints.cluster.local

    > "he only caveat to this, is that if we are using the multi-tenant OVS networking plugin, our cluster administrators will have to make visible our ci project to all other projects:" Ref: https://blog.openshift.com/improving-build-time-java-builds-openshift/
    ```
    $ oadm pod-network make-projects-global ci
    ```
  23. @rafaeltuelho rafaeltuelho revised this gist May 16, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -281,6 +281,7 @@ oc export all --as-template=<template_name>
    * internal DNS name of ose/kubernetes services
    * follows the pattern `<service-name>.<project>.svc.cluster.local`


    Object Type | Example
    --------------- | ----------------------------------------------
    Default | <pod_namespace>.cluster.local
  24. @rafaeltuelho rafaeltuelho revised this gist May 16, 2016. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -281,8 +281,8 @@ oc export all --as-template=<template_name>
    * internal DNS name of ose/kubernetes services
    * follows the pattern `<service-name>.<project>.svc.cluster.local`

    Object Type | Example
    ----------------------------------------------------------------
    Default | <pod_namespace>.cluster.local
    Services | <service>.<pod_namespace>.svc.cluster.local
    Endpoints | <name>.<namespace>.endpoints.cluster.local
    Object Type | Example
    --------------- | ----------------------------------------------
    Default | <pod_namespace>.cluster.local
    Services | <service>.<pod_namespace>.svc.cluster.local
    Endpoints | <name>.<namespace>.endpoints.cluster.local
  25. @rafaeltuelho rafaeltuelho revised this gist May 16, 2016. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -281,7 +281,8 @@ oc export all --as-template=<template_name>
    * internal DNS name of ose/kubernetes services
    * follows the pattern `<service-name>.<project>.svc.cluster.local`

    | Object Type | Example |
    | Default | <pod_namespace>.cluster.local |
    | Services | <service>.<pod_namespace>.svc.cluster.local|
    | Endpoints | <name>.<namespace>.endpoints.cluster.local|
    Object Type | Example
    ----------------------------------------------------------------
    Default | <pod_namespace>.cluster.local
    Services | <service>.<pod_namespace>.svc.cluster.local
    Endpoints | <name>.<namespace>.endpoints.cluster.local
  26. @rafaeltuelho rafaeltuelho revised this gist May 16, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -279,4 +279,9 @@ oc export all --as-template=<template_name>
    ##Tips

    * internal DNS name of ose/kubernetes services
    * follows the pattern `<service-name>.<project>.svc.cluster.local`
    * follows the pattern `<service-name>.<project>.svc.cluster.local`

    | Object Type | Example |
    | Default | <pod_namespace>.cluster.local |
    | Services | <service>.<pod_namespace>.svc.cluster.local|
    | Endpoints | <name>.<namespace>.endpoints.cluster.local|
  27. @rafaeltuelho rafaeltuelho revised this gist May 16, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -274,4 +274,9 @@ oc export all --as-template=<template_name>
    1. Desliga todos os containers que vc não tá usando no seu ambiente do openshift
    2. Executa em todos os nodes e master o comando: docker rm $(docker ps -a -q)
    3. Remove todas as imagens de todos os nodes e master. Para isso loga em cada uma delas via ssh e remove as imagens usando docker rmi <id da image>. Pega as imagens que começa com o ip do registry 172.30...
    4. configurar GC: https://docs.openshift.com/enterprise/3.1/admin_guide/garbage_collection.html
    4. configurar GC: https://docs.openshift.com/enterprise/3.1/admin_guide/garbage_collection.html

    ##Tips

    * internal DNS name of ose/kubernetes services
    * follows the pattern `<service-name>.<project>.svc.cluster.local`
  28. @rafaeltuelho rafaeltuelho revised this gist May 15, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -264,7 +264,12 @@ oadm registry --service-account=registry \
    --mount-host=<path> --selector=meuselector
    ```

    ## Cluester nodes CleanUp
    * to export all resources from a project/namespace as a template
    ```
    oc export all --as-template=<template_name>
    ```

    ## Cluster nodes CleanUp

    1. Desliga todos os containers que vc não tá usando no seu ambiente do openshift
    2. Executa em todos os nodes e master o comando: docker rm $(docker ps -a -q)
  29. @rafaeltuelho rafaeltuelho revised this gist May 15, 2016. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -255,6 +255,15 @@ oc volume dc/<dc_name> \
    ```
    oadm manage node <nome do node > --schedulable=false
    ```
    * to create a registry with storage-volume mounted on host
    ```
    oadm registry --service-account=registry \
    --config=/etc/origin/master/admin.kubeconfig \
    --credentials=/etc/origin/master/openshift-registry.kubeconfig \
    --images='registry.access.redhat.com/openshift3/ose-${component}:${version}' \
    --mount-host=<path> --selector=meuselector
    ```

    ## Cluester nodes CleanUp

    1. Desliga todos os containers que vc não tá usando no seu ambiente do openshift
  30. @rafaeltuelho rafaeltuelho revised this gist May 15, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions osev3-common-cli.md
    Original file line number Diff line number Diff line change
    @@ -255,3 +255,9 @@ oc volume dc/<dc_name> \
    ```
    oadm manage node <nome do node > --schedulable=false
    ```
    ## Cluester nodes CleanUp

    1. Desliga todos os containers que vc não tá usando no seu ambiente do openshift
    2. Executa em todos os nodes e master o comando: docker rm $(docker ps -a -q)
    3. Remove todas as imagens de todos os nodes e master. Para isso loga em cada uma delas via ssh e remove as imagens usando docker rmi <id da image>. Pega as imagens que começa com o ip do registry 172.30...
    4. configurar GC: https://docs.openshift.com/enterprise/3.1/admin_guide/garbage_collection.html