Last active
June 3, 2018 16:59
-
-
Save noelbundick/e95a7b9212f4b3c3038f2885d5468ee3 to your computer and use it in GitHub Desktop.
Open Service Broker for Azure + Mongo console
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
# Setup links | |
# Azure Container Service (AKS): https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough | |
# Open Service Broker for Azure: https://docs.microsoft.com/en-us/azure/aks/integrate-azure | |
# In your shell | |
kubectl apply -f mongoApp.yml | |
kubectl get pods -l run=mongo | |
# Use the pod name from 'get pods' | |
kubectl exec -it mongo-56fd68d4f9-llqqt bash | |
# Inside the mongo pod | |
mongo --host $COSMOS_HOST --port $COSMOS_PORT --username $COSMOS_USERNAME --password $COSMOS_PASSWORD --ssl | |
# In the mongo shell | |
db.users.insertOne({name:"Darth Vader", type:"Villain"}) | |
db.users.insertOne({name:"Luke Skywalker", type:"Hero"}) | |
db.users.insertOne({name:"Chewbacca", type:"Hero"}) | |
db.users.find({type:"Hero"}) | |
db.users.drop() |
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
MIT License | |
Copyright (c) 2018 Noel Bundick | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all | |
copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
SOFTWARE. |
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
apiVersion: servicecatalog.k8s.io/v1beta1 | |
kind: ServiceInstance | |
metadata: | |
name: mongodb-instance | |
namespace: default | |
spec: | |
clusterServiceClassExternalName: azure-cosmos-mongo-db | |
parameters: | |
location: eastus | |
resourceGroup: webscale | |
tags: | |
foo: bar | |
--- | |
apiVersion: servicecatalog.k8s.io/v1beta1 | |
kind: ServiceBinding | |
metadata: | |
name: mongodb-binding | |
namespace: default | |
spec: | |
instanceRef: | |
name: mongodb-instance | |
secretName: mongodb-secret | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
annotations: | |
deployment.kubernetes.io/revision: "3" | |
creationTimestamp: null | |
generation: 1 | |
labels: | |
run: mongo | |
name: mongo | |
selfLink: /apis/extensions/v1beta1/namespaces/default/deployments/mongo | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
run: mongo | |
strategy: | |
rollingUpdate: | |
maxSurge: 1 | |
maxUnavailable: 1 | |
type: RollingUpdate | |
template: | |
metadata: | |
creationTimestamp: null | |
labels: | |
run: mongo | |
spec: | |
containers: | |
- env: | |
- name: COSMOS_CONNSTRING | |
valueFrom: | |
secretKeyRef: | |
key: connectionString | |
name: mongodb-secret | |
- name: COSMOS_HOST | |
valueFrom: | |
secretKeyRef: | |
key: host | |
name: mongodb-secret | |
- name: COSMOS_PASSWORD | |
valueFrom: | |
secretKeyRef: | |
key: password | |
name: mongodb-secret | |
- name: COSMOS_PORT | |
valueFrom: | |
secretKeyRef: | |
key: port | |
name: mongodb-secret | |
- name: COSMOS_USERNAME | |
valueFrom: | |
secretKeyRef: | |
key: username | |
name: mongodb-secret | |
image: mongo | |
imagePullPolicy: Always | |
name: mongo | |
resources: {} | |
terminationMessagePath: /dev/termination-log | |
terminationMessagePolicy: File | |
dnsPolicy: ClusterFirst | |
restartPolicy: Always | |
schedulerName: default-scheduler | |
securityContext: {} | |
terminationGracePeriodSeconds: 30 | |
status: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment