Created
March 20, 2018 12:33
-
-
Save vfarcic/1a01b0e109de08f713ba1fb2abf889a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source kops | |
export BUCKET_NAME=devops23-$(date +%s) | |
export KOPS_STATE_STORE=s3://$BUCKET_NAME | |
aws s3api create-bucket \ | |
--bucket $BUCKET_NAME \ | |
--create-bucket-configuration \ | |
LocationConstraint=$AWS_DEFAULT_REGION | |
# Windows only | |
alias kops="docker run -it --rm \ | |
-v $PWD/devops23.pub:/devops23.pub \ | |
-v $PWD/config:/config \ | |
-e KUBECONFIG=/config/kubecfg.yaml \ | |
-e NAME=$NAME -e ZONES=$ZONES \ | |
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ | |
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \ | |
-e KOPS_STATE_STORE=$KOPS_STATE_STORE \ | |
vfarcic/kops" | |
kops create cluster \ | |
--name $NAME \ | |
--master-count 3 \ | |
--node-count 3 \ | |
--node-size t2.xlarge \ | |
--master-size t2.small \ | |
--zones $ZONES \ | |
--master-zones $ZONES \ | |
--ssh-public-key devops23.pub \ | |
--networking kubenet \ | |
--yes | |
kops validate cluster | |
# Windows only | |
kops export kubecfg --name ${NAME} | |
# Windows only | |
export \ | |
KUBECONFIG=$PWD/config/kubecfg.yaml | |
kubectl create \ | |
-f https://raw.githubusercontent.com/kubernetes/kops/master/addons/ingress-nginx/v1.6.0.yaml | |
kubectl --namespace kube-ingress \ | |
get all | |
kubectl create ns jenkins | |
CLUSTER_DNS=$(aws elb describe-load-balancers \ | |
| jq -r \ | |
".LoadBalancerDescriptions[] \ | |
| select(.DNSName \ | |
| contains (\"api\") | not)\ | |
.DNSName") | |
echo $CLUSTER_DNS | |
open "https://downloads.cloudbees.com/cje2/latest/" | |
# Copy the link to cje2_*_kubernetes.tgz | |
curl -o cje.tgz [ADDRESS_OF_THE_RELEASE] | |
tar -xvf cje.tgz | |
cd cje2-kubernetes | |
ls -l | |
kubectl get sc -o yaml | |
cat cje.yml | |
cat cje.yml \ | |
| sed -e \ | |
"s@https://cje.example.com@http://cje.example.com@g" \ | |
| sed -e \ | |
"[email protected]@$CLUSTER_DNS@g" \ | |
| sed -e \ | |
"s@ssl-redirect: \"true\"@ssl-redirect: \"false\"@g" \ | |
| kubectl --namespace jenkins \ | |
create -f - \ | |
--save-config --record | |
kubectl --namespace jenkins \ | |
get all | |
open "http://$CLUSTER_DNS/cjoc" | |
kubectl --namespace jenkins \ | |
exec cjoc-0 -- \ | |
cat /var/jenkins_home/secrets/initialAdminPassword |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment