Let's look at some basic kubectl output options.
Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).
We can start with:
kubectl get no
#!/bin/bash | |
readonly DB_FILE="$(pwd)/images.db" | |
readonly IMG_DIR="$(pwd)/images" | |
save-images() { | |
echo "Create ${DB_FILE}" | |
echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}" | |
echo "Read ${DB_FILE}" |
#! /bin/bash | |
wordpressPath=/srv/wp01 | |
wordpressName=wordpress01 | |
wordpressPwd=pAssw0rd | |
wordpressUrl=wordpress01.example.com | |
################################## | |
mkdir -p "$wordpressPath"/db |
FROM alpine:3.3 | |
MAINTAINER Tom Maiaroto <[email protected]> | |
# Install packages | |
RUN apk --update --repository http://dl-3.alpinelinux.org/alpine/edge/main add \ | |
freetype-dev \ | |
libjpeg-turbo-dev \ | |
libpng-dev \ | |
libwebp-dev \ | |
php7 \ |
{ | |
"kind": "DeploymentConfig", | |
"apiVersion": "v1", | |
"metadata": { | |
"name": "che", | |
"namespace": "test", | |
"selfLink": "/oapi/v1/namespaces/test/deploymentconfigs/che", | |
"uid": "e3f4a486-6555-11e6-a815-54ee752009cb", | |
"resourceVersion": "549", | |
"generation": 1, |
Packer
Packer is used to build image from a base image, perform provisions and store (commit) the final image.
We use provisioners and Packer templates to do the actual work to create the final image.
We use Ansible for provisioning.
node { | |
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1' | |
echo 'No quotes, pipeline command in single quotes' | |
sh 'echo $BUILD_NUMBER' // 1 | |
echo 'Double quotes are silently dropped' | |
sh 'echo "$BUILD_NUMBER"' // 1 | |
echo 'Even escaped with a single backslash they are dropped' | |
sh 'echo \"$BUILD_NUMBER\"' // 1 | |
echo 'Using two backslashes, the quotes are preserved' | |
sh 'echo \\"$BUILD_NUMBER\\"' // "1" |
# Both are limited to HVM-based 64-bit AMIs backed by EBS | |
# Red Hat's latest GA images | |
alias ami_rhel="aws ec2 describe-images \ | |
--filters \ | |
'Name=root-device-type,Values=ebs' \ | |
'Name=architecture,Values=x86_64' \ | |
'Name=virtualization-type,Values=hvm' \ | |
'Name=name,Values=*GA*' \ | |
--owners 309956199498 \ |
#!/bin/bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
docker inspect $(docker ps -q) \ | |
| jq -c '.[] | {name: .["Name"], ips: .["NetworkSettings"]["Networks"] | map(.IPAddress)} | [.name, .ips]' |