This repository has been archived by the owner on Dec 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
k8s: atlas broker deployment and usage examples
- Loading branch information
Michael Serpieri
committed
Jan 8, 2018
1 parent
938b492
commit 4b9af64
Showing
7 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
k8s resources | ||
============= | ||
|
||
Atlas Broker Deployment | ||
----------------------- | ||
|
||
.. code:: bash | ||
export NS="atlas-broker" | ||
kubectl create ns $NS | ||
kubectl -n $NS apply -f atlas-broker-deployment.yaml | ||
kubectl -n $NS apply -f atlas-broker-svc.yaml | ||
# Declaration of the broker | ||
kubectl apply -f atlas-broker-clusterservicebroker.yaml | ||
Test | ||
---- | ||
|
||
Instance and Binding | ||
^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. code:: bash | ||
kubectl create ns test-atlas-broker | ||
kubectl apply -f atlas-broker-instance.yaml | ||
kubectl apply -f atlas-broker-binding.yaml | ||
Pod | ||
^^^ | ||
|
||
The purpose is to demonstrate how to expose secrets set by the previous binding operation. | ||
|
||
There is 3 ways to do it: | ||
- Individuals mapping (see env section) | ||
- Global mapping (see envFrom section) | ||
- File mapping (see volumeMounts/volumes) | ||
|
||
.. code:: bash | ||
kubectl apply -f nginx.yaml |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: servicecatalog.k8s.io/v1beta1 | ||
kind: ServiceBinding | ||
metadata: | ||
name: atlas-broker-binding | ||
namespace: test-atlas-broker | ||
spec: | ||
instanceRef: | ||
name: atlas-broker-instance |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: servicecatalog.k8s.io/v1beta1 | ||
kind: ClusterServiceBroker | ||
metadata: | ||
name: atlas-broker | ||
spec: | ||
url: http://atlas-broker.atlas-broker.svc.cluster.local |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: atlas-broker | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
project: atlas-broker | ||
template: | ||
metadata: | ||
labels: | ||
project: atlas-broker | ||
app: atlas-broker | ||
spec: | ||
containers: | ||
- env: | ||
image: atlas-broker:1 | ||
imagePullPolicy: Always | ||
name: atlas-broker | ||
resources: {} | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
schedulerName: default-scheduler | ||
securityContext: {} | ||
serviceAccount: default | ||
serviceAccountName: default | ||
terminationGracePeriodSeconds: 10 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: servicecatalog.k8s.io/v1beta1 | ||
kind: ServiceInstance | ||
metadata: | ||
name: atlas-broker-instance | ||
namespace: test-atlas-broker | ||
spec: | ||
clusterServiceClassExternalName: atlas-mongodb-cluster | ||
clusterServicePlanExternalName: atlas-mongodb-existing-cluster | ||
parameters: | ||
cluster: cluster-dev | ||
ns: test-atlas-broker |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: atlas-broker | ||
name: atlas-broker | ||
spec: | ||
ports: | ||
- port: 80 | ||
protocol: TCP | ||
targetPort: 5000 | ||
selector: | ||
app: atlas-broker | ||
sessionAffinity: None | ||
type: ClusterIP |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx | ||
namespace: test-atlas-broker | ||
labels: | ||
app: web | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
env: | ||
- name: ATLAS_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: atlas-broker-binding | ||
key: username | ||
- name: ATLAS_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: atlas-broker-binding | ||
key: password | ||
- name: ATLAS_DATABASE | ||
valueFrom: | ||
secretKeyRef: | ||
name: atlas-broker-binding | ||
key: database | ||
- name: ATLAS_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: atlas-broker-binding | ||
key: uri | ||
envFrom: | ||
- secretRef: | ||
name: atlas-broker-binding | ||
volumeMounts: | ||
- name: atlas | ||
mountPath: "/var/run/secrets/selfservice/atlas" | ||
readOnly: true | ||
volumes: | ||
- name: atlas | ||
secret: | ||
secretName: atlas-broker-binding | ||
defaultMode: 256 |