Bitbucket Pipelines
Powered by Kubernetes
Nathan Burrell - Senior Developer - Atlassian
What Is Bitbucket
Pipelines?
Bitbucket Pipelines - Powered by Kubernetes
Bitbucket Pipelines - Powered by Kubernetes
Bitbucket Pipelines - Powered by Kubernetes
Bitbucket Pipelines - Powered by Kubernetes
Pipelines
Use Cases
Remote Code Execution
Run any and all code, any docker image.
Run our own
Infrastructure
Atlassian uses AWS exclusively so we have to run
kubernetes cluster.
Multi-tenanted
We run all customer builds in the same cluster, with
different customers pods on the same machine.
“Short” lived batch jobs.
Run pods that have lifetimes of minutes to hours.
Kubernetes and Pipelines
InfrastructureArchitecture
Namespaces
Namespaces are
Bitbucket Accounts.
kube-system
kube-api
Kube-proxy
Kube-scheduler
...
pipelines
docker-registry
datadog-agent
...
default
account0
step0
step1
...
Secrets
Secrets are
Environment Variables.
Bitbucket Pipelines - Powered by Kubernetes
apiVersion: v1
kind: Secret
metadata:
name: environment-variables
type: Opaque
data:
username: c29tZXRoaW5nCg==
password: c2VjdXJlCg==
pipelines:
default:
- step:
image:
name: private/image:latest
username: $USERNAME
Password: $PASSWORD
script:
...
apiVersion: v1
kind: Secret
metadata:
name: build-image-docker-
credentials
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson:
eyAiYXV0aHMiOiB7ICJodHRwczovL2l
uZGV4LmRvY2tlci5pby92MS8iOiB7IC
JhdXRoIjogIlpHOWphMlZ5T214dloyb
HVDZz09IiB9IH0gfQo=
Pods
Pods are Steps.
options:
docker: true
definitions:
services:
redis: redis:latest
pipelines:
default:
- step:
services:
- redis
image: my/image:latest
script:
...
apiVersion: v1
kind: Pod
spec:
containers:
- name: build
image: my/image:latest
- name: service-redis
image: redis:latest
- name: system-docker
image: pipelines/docker:1.0
securityContext:
- privileged: true
Pod
agent clone builddocker serviceserviceservice
volumes
● tmp
● scripts
● containers
● empty
● /dev/shm
4gb ram resource
requirement
privileged with a
custom docker
auth plugin
Deployments
Deployment Set for
Node Scaler.
Custom Node Scaler
Autoscaling Group
Node
kubernetes-master node-scaler-pod
1. Query number of “step”
pods currently in cluster
2. Set capacity as required
Daemon Sets
Daemon Sets
for Helpers.
https://docs.docker.com/registry/recipes/mirror/
Running an image cache.
Node
docker
registry-pod
Node
docker
registry-pod
docker-registry S3
1. Try Pull from cache
2. Fallback to registry
3. Store public layers
https://github.com/fluent/fluentd-kubernetes-daemonset
Collecting logs.
Node
fluentd
splunk
Scans the docker container
directory and
parses/enriches container
logs
Uploads logs
https://docs.datadoghq.com/integrations/kubernetes/
Collecting metrics.
Node
datadog-agent
datadog
docker
Collect node metricsCollect container metrics
Publish
Bitbucket Pipelines - Powered by Kubernetes
The Boring Stuff
Everything is on
AWS
Atlassian is going BIG on AWS for its cloud
infrastructure
Ansible + Cloudformation
Is the secret sauce to having immutable
Infrastructure
Container Linux as a base
Container Linux from CoreOS gives us a secure well
tested base to build upon
Tip #1
Size your API
instances correctly.
https://kubernetes.io/docs/admin/cluster-large
Number of Nodes Instance Recommendation
AWS gcloud
1-5 m3.medium n1-standard-1
6-11 m3.large n1-standard-2
11-100 m3.xlarge n1-standard-4
Various parts of the kubernetes codebase
“
~60mb of capacity per
node
Tip #2
Size your etcd
instances correctly.
https://coreos.com/etcd/docs/latest/op-guide/hardware.html
Cluster Requirement Instance Recommendation
AWS gcloud
100 Clients, 200 RQPS,
100MB Data
m4.large n1-standard-1
500 Clients, 1000 RQPS,
500MB Data
m4.xlarge n1-standard-4
1500 Clients, 10000 RQPS,
1GB Data
m4.2xlarge n1-standard-8
Tip #3
Split etcd into role
based clusters.
Control Plane VPC Worker Plane VPC
Node
flannel
kubernetes-etcd
flannel-etcd
peering
master
Tip #4
Use network policies.
https://github.com/projectcalico/canal/blob/master/InstallGuide.md
Node
flannel
calico
etcd
master
apiVersion: v1
kind: Namespace
metadata:
name: network-policy
annotations:
net.beta.kubernetes.io/network-policy: '{"ingress": {"isolation": "DefaultDeny"}}'
Monitors for changes in network policies and
applies new iptable rules
Tip #5
Hide default secrets.
apiVersion: v1
kind: Pod
metadata:
name: hide-secrets
spec:
volumes:
- hidden
containers:
- name: potentially-malicious
image: potentially/malicous:image
volumeMounts:
- name: hidden
mountPath:
/var/run/secrets/kubernetes.io/serviceaccount
readOnly:true
Tip #6
Secure the kubelet.
https://kubernetes.io/docs/admin/kubelet/
Node
kubelet: 10255
pod
Disable the read only port.
--read-only-port=0 (default: 10255)
No credentials required
https://kubernetes.io/docs/admin/kubelet-authentication-
Node
kubelet: 10250
pod
Enable authentication on kubelet port.
--anonymous-auth=false (default: true)
--authentication-token-webhook=true (default: false)
No credentials required
Tip #7
KubeDNS Can Be
Unreliable.
Bitbucket Pipelines - Powered by Kubernetes
apiVersion: v1
kind: Pod
metadata:
name: hide-secrets
spec:
dnsPolicy: Default
Takeaways
SecurityScaleMappings
Thank You
Nathan Burrell - Senior Developer - Atlassian

More Related Content

PPTX
Serverless technologies with Kubernetes
PPTX
Orchestrating Docker Containers with Google Kubernetes on OpenStack
PDF
DevOps in AWS with Kubernetes
PPTX
Kubernetes Introduction
PDF
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
PDF
Kubernetes Introduction
PDF
Running Production-Grade Kubernetes on AWS
PPTX
Kubernetes HA @ AppDirect - Montreal Kubernetes Meetup
Serverless technologies with Kubernetes
Orchestrating Docker Containers with Google Kubernetes on OpenStack
DevOps in AWS with Kubernetes
Kubernetes Introduction
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
Kubernetes Introduction
Running Production-Grade Kubernetes on AWS
Kubernetes HA @ AppDirect - Montreal Kubernetes Meetup

What's hot (20)

PPTX
Introduction to Kubernetes
PDF
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
PDF
Kubernetes Architecture and Introduction
PPTX
DevOps with Kubernetes
PDF
Continuous Delivery the hard way with Kubernetes
PPTX
Kubernetes Networking 101
PDF
Scaling Docker with Kubernetes
PDF
Kubernetes 101
PDF
[OpenInfra Days Korea 2018] Day 2 - E4 - 딥다이브: immutable Kubernetes architecture
PPTX
Stateful set in kubernetes implementation & usecases
PDF
The top 5 Kubernetes metrics to monitor
PDF
Hands-On Introduction to Kubernetes at LISA17
PPTX
Scaling Jenkins with Kubernetes by Ami Mahloof
PDF
Apache Stratos 4.1.0 Architecture
PDF
Kubernetes - Starting with 1.2
PPTX
Scaling Docker Containers using Kubernetes and Azure Container Service
PDF
Kubernetes on AWS
PPTX
Containerizing a REST API and Deploying to Kubernetes
PDF
Docker Online Meetup: Infrakit update and Q&A
Introduction to Kubernetes
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Kubernetes Architecture and Introduction
DevOps with Kubernetes
Continuous Delivery the hard way with Kubernetes
Kubernetes Networking 101
Scaling Docker with Kubernetes
Kubernetes 101
[OpenInfra Days Korea 2018] Day 2 - E4 - 딥다이브: immutable Kubernetes architecture
Stateful set in kubernetes implementation & usecases
The top 5 Kubernetes metrics to monitor
Hands-On Introduction to Kubernetes at LISA17
Scaling Jenkins with Kubernetes by Ami Mahloof
Apache Stratos 4.1.0 Architecture
Kubernetes - Starting with 1.2
Scaling Docker Containers using Kubernetes and Azure Container Service
Kubernetes on AWS
Containerizing a REST API and Deploying to Kubernetes
Docker Online Meetup: Infrakit update and Q&A
Ad

Similar to Bitbucket Pipelines - Powered by Kubernetes (20)

PPTX
How do we use Kubernetes
PDF
Best Practices with Azure Kubernetes Services
PDF
AWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul Maddox
PPTX
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
PPTX
Kubernetes-Fundamentals.pptx
PDF
Docker clusters on AWS with Amazon ECS and Kubernetes
PDF
1. CNCF kubernetes meetup - Ondrej Sika
PDF
Automate Your Kafka Cluster with Kubernetes Custom Resources
PDF
Building a Kubernetes App with Amazon EKS
PDF
Deploying a Kubernetes App with Amazon EKS
PDF
Aws + kubernetes = ❤︎
PPTX
AWS-Fargate-and-AWS-EKS-Masterclass-V7.pptx
PDF
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
PPTX
before-v7-AWS-Fargate-and-EKS-Masterclass.pptx
PDF
DevJam 2019 - Introduction to Kubernetes
PDF
Kubernetes: Container Orchestration for Production-grade People
PPTX
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...
PPTX
EKS New features - Re:invent 2022 recap at AWSUGNL Benelux
PDF
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
PDF
12.07.2017 Docker Meetup - KUBERNETES ON AWS @ ZALANDO TECH
How do we use Kubernetes
Best Practices with Azure Kubernetes Services
AWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul Maddox
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
Kubernetes-Fundamentals.pptx
Docker clusters on AWS with Amazon ECS and Kubernetes
1. CNCF kubernetes meetup - Ondrej Sika
Automate Your Kafka Cluster with Kubernetes Custom Resources
Building a Kubernetes App with Amazon EKS
Deploying a Kubernetes App with Amazon EKS
Aws + kubernetes = ❤︎
AWS-Fargate-and-AWS-EKS-Masterclass-V7.pptx
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
before-v7-AWS-Fargate-and-EKS-Masterclass.pptx
DevJam 2019 - Introduction to Kubernetes
Kubernetes: Container Orchestration for Production-grade People
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...
EKS New features - Re:invent 2022 recap at AWSUGNL Benelux
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
12.07.2017 Docker Meetup - KUBERNETES ON AWS @ ZALANDO TECH
Ad

Recently uploaded (20)

PDF
August -2025_Top10 Read_Articles_ijait.pdf
PDF
electrical machines course file-anna university
PPTX
Micro1New.ppt.pptx the mai themes of micfrobiology
PPTX
Agentic Artificial Intelligence (Agentic AI).pptx
PPTX
CS6006 - CLOUD COMPUTING - Module - 1.pptx
DOCX
ENVIRONMENTAL PROTECTION AND MANAGEMENT (18CVL756)
PPTX
Solar energy pdf of gitam songa hemant k
PPTX
SE unit 1.pptx aaahshdhajdviwhsiehebeiwheiebeiev
PPTX
Environmental studies, Moudle 3-Environmental Pollution.pptx
PDF
Computer System Architecture 3rd Edition-M Morris Mano.pdf
PPTX
CT Generations and Image Reconstruction methods
PDF
Project_Mgmt_Institute_-Marc Marc Marc .pdf
PDF
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering
PDF
AIGA 012_04 Cleaning of equipment for oxygen service_reformat Jan 12.pdf
PPT
Programmable Logic Controller PLC and Industrial Automation
PDF
Cryptography and Network Security-Module-I.pdf
PPTX
Cisco Network Behaviour dibuywvdsvdtdstydsdsa
PPTX
CNS - Unit 1 (Introduction To Computer Networks) - PPT (2).pptx
PDF
Computer organization and architecuture Digital Notes....pdf
PDF
Principles of operation, construction, theory, advantages and disadvantages, ...
August -2025_Top10 Read_Articles_ijait.pdf
electrical machines course file-anna university
Micro1New.ppt.pptx the mai themes of micfrobiology
Agentic Artificial Intelligence (Agentic AI).pptx
CS6006 - CLOUD COMPUTING - Module - 1.pptx
ENVIRONMENTAL PROTECTION AND MANAGEMENT (18CVL756)
Solar energy pdf of gitam songa hemant k
SE unit 1.pptx aaahshdhajdviwhsiehebeiwheiebeiev
Environmental studies, Moudle 3-Environmental Pollution.pptx
Computer System Architecture 3rd Edition-M Morris Mano.pdf
CT Generations and Image Reconstruction methods
Project_Mgmt_Institute_-Marc Marc Marc .pdf
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering
AIGA 012_04 Cleaning of equipment for oxygen service_reformat Jan 12.pdf
Programmable Logic Controller PLC and Industrial Automation
Cryptography and Network Security-Module-I.pdf
Cisco Network Behaviour dibuywvdsvdtdstydsdsa
CNS - Unit 1 (Introduction To Computer Networks) - PPT (2).pptx
Computer organization and architecuture Digital Notes....pdf
Principles of operation, construction, theory, advantages and disadvantages, ...

Bitbucket Pipelines - Powered by Kubernetes

Editor's Notes

  • #29: One/Two of your masters will always consume more CPU/Memory due to scheduler/controller leader election. Consider splitting API servers into responsibility based instances.
  • #30: One/Two of your masters will always consume more CPU/Memory due to scheduler/controller leader election. Consider splitting API servers into responsibility based instances.
  • #31: One/Two of your masters will always consume more CPU/Memory due to scheduler/controller leader election. Consider splitting API servers into responsibility based instances.
  • #32: Losing API instances is one thing losing etcd is a nightmare! Requires full cluster recreation once the backing store is lost.
  • #33: Losing API instances is one thing losing etcd is a nightmare! Requires full cluster recreation once the backing store is lost.
  • #34: Split your etcd instance into 2 clusters: One for the kubernetes API backing store One for the flannel backing store Only expose what you need to (principal of least privilege)
  • #35: Split your etcd instance into 2 clusters: One for the kubernetes API backing store One for the flannel backing store Only expose what you need to (principal of least privilege)
  • #36: Kubernetes by default uses flannel as its overlay network allowing for pod - pod communication regardless of host scheduling. Out of the box this allows any pod to talk to any other pod in the cluster (provided they know the ip addresses and ports of the services the pod exposes). Secure this with software defined rules using calico and network policies.
  • #37: Kubernetes by default uses flannel as its overlay network allowing for pod - pod communication regardless of host scheduling. Out of the box this allows any pod to talk to any other pod in the cluster (provided they know the ip addresses and ports of the services the pod exposes). Secure this with software defined rules using calico and network policies.
  • #38: Kubernetes is nice enough to mount into every container a default secret directory containing the certificate authority and token to allow you to authenticate with the api-servers as the namespace you are running in.
  • #39: Kubernetes is nice enough to mount into every container a default secret directory containing the certificate authority and token to allow you to authenticate with the api-servers as the namespace you are running in.
  • #40: By default the kubelet binds to two ports on a node that allow requests against the API also the default configurations are insecure.
  • #41: By default the kubelet binds to two ports on a node that allow requests against the API also the default configurations are insecure.
  • #42: By default the kubelet binds to two ports on a node that allow requests against the API also the default configurations are insecure.
  • #43: KubeDNS performs well enough for low load and low volumes of requests but doesnt perform well under load.
  • #44: KubeDNS performs well enough for low load and low volumes of requests but doesnt perform well under load.
  • #45: KubeDNS performs well enough for low load and low volumes of requests but doesnt perform well under load.