- Kublr 1.19.0+
- Kubernetes 1.18+
- AWS account
Use Kublr to deploy cluster using one of the specs in deovops-env
directory:
kublr-cluster-us-east-1.yaml
or kublr-cluster-us-east-2.yaml
- Ceate a space
devops
in Kublr UI (you can use a different space, but then you will need ) - Create an AWS secret named
ws
in the space - Start creating a new cluster, click "Customize specification" and replace yaml in the dialog that opens with one of the providedspecifications.
What to change to adjust to your enviroment:
-
If you want to use a different space rather than
devops
, change the space in https://github.com/kublr/devops-demo/blob/master/devops-env/kublr-cluster-us-east-1.yaml#L4 -
If you want to use a different region and availability zones:
- Change the region in https://github.com/kublr/devops-demo/blob/master/devops-env/kublr-cluster-us-east-1.yaml#L11
- Change AZs in https://github.com/kublr/devops-demo/blob/master/devops-env/kublr-cluster-us-east-1.yaml#L15-L17
- Change EFS Mount Targets in https://github.com/kublr/devops-demo/blob/master/devops-env/kublr-cluster-us-east-1.yaml#L22-L39
Here most importantly the designations of target subnets must be changed according to the AZs used.
Kublr uses AZ numbering convention where AZs ending with
a
(e.g.us-east-1a
) are numbered0
,b
-1
,c
-2
etc. Therefore if you want to use, for example, AZsus-west-2c
,us-west-2d
, andus-west-2f
, then the Mount Target names should be changed toDevOpsDemoEFSMT2
,DevOpsDemoEFSMT3
andDevOpsDemoEFSMT5
in the spec lines 22, 28 and 34 correspondingly, and the subnet names should beSubnetNodePublic2
,SubnetNodePublic3
, andSubnetNodePublic5
in the spec lines 27, 33, 39 correspondingly.
-
You will need to use your own Route 53 domain and Letsencrypt identification for the demo to work correctly; Change the domain and email in the spec lines 155, 181, 182, 216, 218, and 220
Other possible variation points that you may or may not want to modify or experiment with:
- AMI used
- instance types
- the size of the cluster
- jenkins and nexus configuration
As soon as the cluster is started, open the Kubernetes dashboard and check the name of the load balancer
allocated for the cluster's ingress controller, namely the service kublr-ingress-nginx-ingress-controller
in the
kube-system
or use the following CLI console command for that:
kubectl get svc -n kube-system kublr-ingress-nginx-ingress-controller
Create an Route 53 alias wildcard record for *.devops-demo-us-east-1.workshop.kublr.com
(or the domain of your
choice that you configured in the cluster spec) and point it at the corresponding ELB created for the cluster ingress.
Almost immediately the Jenkins and Nexus URLs will become available, although it may take several minutes until valid Letsencrypt certificates are issued; initially the browser may show that the connection is insecure.
Make sure that at least Nexus certificates are valid before procedeing to the next steps.
- Open Nexus UI at https://nexus.devops-demo-us-east-1.workshop.kublr.com
- Login with the default nexus admin account
admin
/admin123
- In the setup wizard that opens on the first login enable anonymous repository browsing
- Go to the Settings screen
- Add DockerBearerToken realm in the "Configure Security" > "Realms"
- Create a new hosted docker registry, with the following settings:
- Name: docker-hosted
- HTTP port: 5003
- Allow anonymous pull: yes
The registry will be available at the address cr.devops-demo-us-east-1.workshop.kublr.com
You can test that it works by running the following commands:
docker pull alpine
docker tag alpine cr.devops-demo-us-east-2.workshop.kublr.com/alpine/alpine
docker login cr.devops-demo-us-east-2.workshop.kublr.com -u admin -p admin123
docker push cr.devops-demo-us-east-2.workshop.kublr.com/alpine/alpine
docker logout cr.devops-demo-us-east-2.workshop.kublr.com
docker rmi cr.devops-demo-us-east-2.workshop.kublr.com/alpine/alpine
docker pull cr.devops-demo-us-east-2.workshop.kublr.com/alpine/alpine
- Get your Jenkins
admin
user password by running:printf $(kubectl get secret --namespace devops jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo
- Open UI at https://jenkins.devops-demo.workshop.kublr.com
- Login with the password from step 1 and the username:
admin
- Register pipeline parameters: in 'Manage Jenkins' > 'Manage Credentials' create new records in '(Global)' domain:
docker-registry-cred
of type "username/password" with valuesadmin
/admin123
docker-registry-address
of type "secret text" with valuecr.devops-demo-us-east-2.workshop.kublr.com
cluster-domain
of type "secret text" with valuedevops-demo-us-east-2.workshop.kublr.com
- Use kublr UI or Kubernetes CLI to assign
cluster-admin
Cluster Role to Jenkins service - Create a new multi-branch pipeline project
- Add a new 'Branch Source' of type 'Git'; use https git link (to avoid the need to provide and register
SSH keys as the project is public anyway)
https://github.com/kublr/devops-demo.git
for the project source - add 'Checkout to matching local branch' behaviour for the Git Source
- Add a new 'Branch Source' of type 'Git'; use https git link (to avoid the need to provide and register
SSH keys as the project is public anyway)
As soon as you save this project, the build process for master
and feature/blue
branch (or any other branches
available in the repository at the time) should start, run and deploy the application to the master
and
featureblue
namespaces (and potentially other namespaces corresponding to the branches) in the Kubernetes cluster.
The applications will be available on individual URLs such as https://simple-api.master.devops-demo-us-east-2.workshop.kublr.com
(for master
branch) or https://simple-api.featureblue.devops-demo-us-east-2.workshop.kublr.com (for feature/blue
branch).