This documentation relates to QuickBuild 8.0.x
Select here if you are using a different version

Launch Node in Kubernetes

Version 2 by Robin Shen
on Jan 08, 2018 11:30.


compared with
Current by Robin Shen
on Jan 11, 2018 12:02.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 6 changes. View first change.

 {note} Kubernetes plugin required Java 1.8 or higher to run{note}
  
 h2. Kubernetes cloud profile
 Cloud profiles rely on cloud providers to do its job. QuickBuild 8.0 ships with the Kubernetes cloud provider. To use it, one has to enable the Kubernetes plugin by providing a configuration file in _Administration/Plugin Management_ page as demonstrated below:
 
 !kubernetes-setting.png!
  
 Then one can follow the [cloud profiles|Working with Cloud Profiles] guide to create cloud profiles using Kubernetes launchers like below:
 !kubernetes-launcher.png!
  
The {anchor:create build agent image}The AMI should be pre-configured with your build environment as well as QuickBuild build agent. To configure a AMI with build agent, please do the following:
 # Manually launch an instance of desired platform using your EC2 account, and install Java Runtime Environment version 6 or higher on the launched instance. You may also want to install other software required by your build to this instance.
 # Download QuickBuild build agent package from Grid page, and upload it to launched instance above.
 # Login to the EC2 instance and extract build agent package to your chosen agent installation directory.
 # Edit file _<agent install dir>/conf/wrapper.conf_ to define property _wrapper.java.command_ to point to java binary if it is not in system path.
 # Edit file _<agent install dir>/conf/node.properties_ to configure QuickBuild server URL. You may also run _<agent install dir>/bin/config.(bat|sh)_ to config node properties such as SSL setting. However this program requires GUI terminal, and if your console does not have that facility, you may run this program at your desktop to populate the node.properties, then transfer this file to launched instance.
 # Edit file _<agent install dir>/conf/attributes.properties_ to define necessary user attributes for the build agent.
 # For Unix instances, edit file _<agent install dir>/bin/agent.sh_ to uncomment below line and assign an OS user to run the agent in service mode.
  {anchor:create build agent image}
 h2. Create build agent image
 You should use your own docker image when define the Kubernetes profile. The image should be pre-configured with your build environment as well as QuickBuild build agent. Below is an example to create a Debian Linux image only with OpenJDK and build agent installed.
  
 # Assume we have build agent installed at _/path/to/buildagent_. First run the build agent to make sure it can connect with the build server.
 # Create file _/path/to/buildagent/Dockerfile_ with below content:
 {code}
#RUN_AS_USER=
  FROM openjdk:8-jdk
 ADD . /app
 EXPOSE 8811
 CMD ["/app/bin/wrapper-linux-x86-64", "/app/conf/wrapper.conf"]
 {code}
The service user should own the agent installation directory.
 # Run _<agent install dir>/bin/agent.(sh|bat) install_ to install agent as system service.
 # Edit security group associated with the launched instance to allow incoming connections to agent port.
 # Restart launched node. After the system comes up, the build agent should be started automatically and will contact QuickBuild server to download necessary plugins. You may check file _<agent install dir>/logs/console.log_ for the progress and possible errors.
 # If agent starts up normally, you should be able to see this agent appears at _unauthorized nodes_ list at grid page. Authorize the node and wait for a while to see if it can come active.
 # If the agent comes active, create a EBS AMI for the launched instance and this AMI can then be used to define your cloud profiles to run certain builds. After build agent AMI is created, you may terminate the manually launched instance.
 # You can certainly define multiple build agent AMIs for multiple cloud profiles to satisfy different build requirements.
  # Change to directory _/path/to/buildagent_, and run below command
 {code}
 docker build -t youraccount/qbagent:latest .
 {code}
 # Then publish the built image:
 {code}
 docker push youraccount/qbagent:latest
 {code}
  
 With this example, you should use docker image _youraccount/qbagent:latest_ when define the Kubernetes profile above