User Tools

Site Tools


tech:openshift:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tech:openshift:start [2018/06/07 16:33]
admin
tech:openshift:start [2019/01/05 16:52] (current)
rk4n3
Line 1: Line 1:
 <typo fs:​xx-large;​ fw: bold;>​OpenShift</​typo>​ <typo fs:​xx-large;​ fw: bold;>​OpenShift</​typo>​
 +
 +<​code>​oc import-image <NAME OF STREAM></​code>​
  
 ====== Resources ====== ====== Resources ======
 +[[https://​docs.docker.com/​develop/​develop-images/​dockerfile_best-practices|Dockerfile Best Practices]] \\
 +
 [[https://​www.clouda.ca/​blog/​general/​openshift-on-centos-7-quick-installation|OpenShift on CentOS 7]] \\ [[https://​www.clouda.ca/​blog/​general/​openshift-on-centos-7-quick-installation|OpenShift on CentOS 7]] \\
 [[https://​github.com/​openshift/​origin#​getting-started|OpenShift ''​Getting Started''​ on GitHub]] \\ [[https://​github.com/​openshift/​origin#​getting-started|OpenShift ''​Getting Started''​ on GitHub]] \\
Line 10: Line 14:
 [[http://​sudhaker.com/​10/​install-the-latest-openshift-v3-on-centos-7-1|Sudhaker'​s blog]] \\ [[http://​sudhaker.com/​10/​install-the-latest-openshift-v3-on-centos-7-1|Sudhaker'​s blog]] \\
  
 +
 +  * Packages needed:
 +    * ''​yum install go''​
 +    * Install ''​S2I''​ from: [[https://​github.com/​openshift/​source-to-image/​releases]]
 +  * ?
 +
 +=== Generate Docker Image ===
 +<​code>#​ Gen image via s2i ... using python container
 +IMGBASE=s2i-python-container
 +mkdir s2iloadgen
 +s2i create ${IMGBASE} s2iloadgen</​code>​
 +
 +=== Docker Cheat-Sheet ===
 +  * List all Bluejay-related images:<​code>​docker images | grep -i bluejay</​code>​
 +  * Start container:<​code>​docker run -d -P --name loadgen001 bluejay-loadgen</​code>​
 +  * Show port mapping:<​code>​docker port loadgen001 22</​code>​
 +  * Stop container:<​code>​docker container stop loadgen001</​code>​
 +  * Remove container:<​code>​docker container rm loadgen001</​code>​
 +  * Remove image:<​code>​docker image rm bluejay-loadgen</​code>​
 +
 +------
 +===== Example: Resurrect Bluejay in OpenShift =====
 +  * Set up OpenShift cluster, and start with ''​rc.openshift start''​
 +    * The ''​rc.openshift''​ wrapper calls ''​oc cluster up''​ with args
 +  * Initialize service account<​code>​oc create serviceaccount bluejay
 +oc policy add-role-to-user system:​image-builder -z bluejay
 +oc policy add-role-to-user admin -z bluejay
 +oc sa get-token bluejay</​code>​
 +    * Populate the token into ''​~bluejay/​.bluejayrc''​
 +  * Ensure access to OpenShift docker repo<​code>​docker login -u yourlogin -p $(oc whoami -t) 172.30.1.1:​5000</​code>​
 +  * Build, tag, and push JMeter image<​code>​cd ~/​src/​bluejay/​s2ijm ; make
 +docker tag <​newimage>​ 172.30.1.1:​5000/​bluejay/​jmeter
 +docker push 172.30.1.1:​5000/​bluejay/​jmeter</​code>​
 +  * Build, tag, and push Locust image<​code>​cd ~/​src/​bluejay/​s2iloc ; make
 +docker tag <​newimage>​ 172.30.1.1:​5000/​bluejay/​locust
 +docker push 172.30.1.1:​5000/​bluejay/​locust</​code>​
 +  * Build, tag, and push Maven image<​code>​cd ~/​src/​bluejay/​s2imvn ; make
 +docker tag <​newimage>​ 172.30.1.1:​5000/​bluejay/​maven
 +docker push 172.30.1.1:​5000/​bluejay/​maven</​code>​
 +  * Build, tag, and push Gatling image<​code>​cd ~/​src/​bluejay/​s2igat ; make
 +docker tag <​newimage>​ 172.30.1.1:​5000/​bluejay/​gatling
 +docker push 172.30.1.1:​5000/​bluejay/​gatling</​code>​
 +  * Create image streams<​code>​cd ~/​src/​bluejay/​etc
 +oc create -f loadctl.json
 +oc create -f loadloc.json
 +oc create -f loadmvn.json
 +oc create -f loadgat.json</​code>​
 +  * Create load-gen build configs \\ //Remember to set LDAP credentials in YAML files//<​code>​cd ~/​src/​bluejay/​etc
 +oc create -f bld-loadctl.yaml
 +oc create -f bld-loadloc.yaml
 +oc create -f bld-loadmvn.yaml
 +oc create -f bld-loadgat.yaml</​code>​
 +  * Verify build completions and image streams
 +  * Add OAPT storage \\ //Remember to make it "​shared",​ use name like ''​oaptpubrpt201''//​
 +  * Add OAPT application
 +    * Add OAPT storage at mount path ''/​opt/​app-root/​pub''​
 +
 +------
 ====== Trivia ====== ====== Trivia ======
 +
 +===== Installation:​ Docker & OC CLI =====
 +  * In /​etc/​yum.repos.d/​docker.repo<​code>​[dockerrepo]
 +name=Docker Repository
 +baseurl=https://​yum.dockerproject.org/​repo/​main/​centos/​7
 +enabled=1
 +gpgcheck=1
 +gpgkey=https://​yum.dockerproject.org/​gpg</​code>​
 +  * ''​yum install docker-engine''​
 +  * ''​usermod -aG docker msamud1''​
 +  * ''​chkconfig docker on''​
 +  * Install S2I:  download and extract to /​usr/​local/​bin ...<​code>​wget https://​github.com/​openshift/​source-to-image/​releases/​download/​v1.1.10/​source-to-image-v1.1.10-27f0729d-linux-amd64.tar.gz</​code>​
 +  * OpenShift CLI client (oc):
 +    * Requires active RHEL subscription to download
 +    * Once downloaded, extract "​oc"​ from archive into /​usr/​local/​bin
 +
 +===== PoC/​Exploration Notes =====
 +==== Some URLs researched ... ====
 +http://​www.testautomationguru.com/​jmeter-distributed-load-testing-using-docker/​ \\
 +https://​hub.docker.com/​_/​openjdk/​ \\
 +https://​eleanordare.com/​blog/​2018/​5/​3/​using-a-jenkins-pipeline-to-run-jmeter-tests-in-openshift-bkba6 \\
 +https://​eleanordare.com/​blog/​2017/​6/​14/​using-a-jenkins-pipeline-to-run-jmeter-tests-in-openshift \\
 +https://​blog.openshift.com/​remotely-push-pull-container-images-openshift \\
 +https://​docs.openshift.org/​latest/​dev_guide/​jobs.html \\
 +https://​docs.openshift.com/​enterprise/​3.0/​architecture/​core_concepts/​builds_and_image_streams.html \\
 +https://​blog.openshift.com/​running-any-docker-image-on-openshift-origin/​ \\
 +https://​docs.openshift.com/​online/​architecture/​core_concepts/​builds_and_image_streams.html#​pipeline-build \\
 +https://​docs.openshift.com/​online/​dev_guide/​application_lifecycle/​new_app.html#​dev-guide-new-app \\
 +https://​docs.openshift.com/​online/​dev_guide/​index.html \\
 +https://​docs.openshift.com/​online/​dev_guide/​builds/​build_inputs.html#​image-source \\
 +https://​docs.openshift.com/​online/​dev_guide/​application_lifecycle/​new_app.html \\
 +https://​blog.openshift.com/​getting-any-docker-image-running-in-your-own-openshift-cluster/​ \\
 +https://​blog.openshift.com/​openshift-jobs \\
 +https://​docs.openshift.com/​online/​rest_api/​apis-batch/​v1.Job.html \\
 +
 +==== Initial PoC at Optum'​s OpenShift ====
 +  * Ensure that docker-engine is installed on Linux XaaS VM
 +  * Log in to DTR (Docker Trusted Registry) \\ ''​docker login docker.optum.com''​
 +  * Pull existing repository (previously created in web GUI) \\ ''​docker pull docker.optum.com/​msamud1/​bluejay-jmeter''​
 +  * Build new image using S2I (S2I build is another topic)
 +  * Tag new image in local registry \\ ''​docker tag <​newimageid>​ docker.optum.com/​msamud1/​bluejay-jmeter''​
 +  * Push to DTR \\ ''​docker push docker.optum.com/​msamud1/​bluejay-jmeter''​
 +
 +//**NOTE:** these commands assume being run from $HOME/​src/​bluejay ... // \\
 +  * Log in to Optum'​s OpenShift (this is elk river non-prod) \\ ''​oc login https://​ocp-elr-core-nonprod.optum.com''​
 +  * Create image stream for base JMeter builder image \\ ''​oc create -f ./​etc/​jmeter.yaml''​
 +  * Create image stream for app-specific load controller \\ ''​oc create -f ./​etc/​timbrado.json''​
 +  * Create image stream for load generator(s) \\ ''​oc create -f ./​etc/​loadgen.json''​
 +  * Create BuildConfig for app-specific load controller \\ ''​oc create -f ./​etc/​bld-timbrado.json''​
 +  * Create BuildConfig for load generator(s) \\ ''​oc create -f ./​etc/​bld-loadgen.json''​
 +  * Run a job: \\ ''​oc create -f ./​etc/​job-launch.yaml''​
 +
 +===== Misc ... =====
 +
 ==== Container DNS ==== ==== Container DNS ====
  
 In order for containers to be able to resolve external names, change the ''​dnsIP''​ value in ''/​var/​lib/​origin/​openshift.local.config/​node-localhost/​node-config.yaml''​ to the real LAN's DNS nameserver \\ In order for containers to be able to resolve external names, change the ''​dnsIP''​ value in ''/​var/​lib/​origin/​openshift.local.config/​node-localhost/​node-config.yaml''​ to the real LAN's DNS nameserver \\
  
 +==== SSH Key Initialization ====
 +<​code>​
 +/​usr/​bin/​ssh-keygen -t dsa -f /​etc/​ssh/​ssh_host_dsa_key -N ''​
 +/​usr/​bin/​ssh-keygen -t rsa -f /​etc/​ssh/​ssh_host_rsa_key -N ''​
 +/​usr/​bin/​ssh-keygen -t ecdsa -f /​etc/​ssh/​ssh_host_ecdsa_key -N ''​
 +/​usr/​bin/​ssh-keygen -t ed25519 -f /​etc/​ssh/​ssh_host_ed25519_key -N ''​
 +/​usr/​bin/​ssh-keygen -A
 +</​code>​
 +
 +==== Interesting Resources ====
 +  * [[https://​hub.docker.com/​r/​jdeathe/​centos-ssh]]
  
  \\  \\
tech/openshift/start.1528407218.txt.gz ยท Last modified: 2018/06/07 16:33 by admin