region: # Region where resources will be provisioned. (ex: us-phoenix-1)
tenancy: # Tenancy OCID value
user: # API User OCID value
compartment: # Compartment OCID value
key: # Private API Key file path (ex: /Users/jdoe/.oci/oci_key.pem)
fingerprint: # Public API Key fingerprint (ex: 43:65:2c...)
âšī¸ It is also recommeded to configure the OCI Command Line with using these values. Refer the Documentation on CLI configuration .
mushop
:
git clone \
https://github.com/oracle-quickstart/oci-cloudnative.git \
mushop
Change working directory:
cd mushop
#> mushop
âââ README.md
âââ deploy
â âââ basic
â âââ complete
â âââ docker-compose
â âââ helm-chart
â âââ kubernetes
âââ src
âââ api
âââ assets
âââ carts
âââ catalogue
âââ edge-router
âââ events
âââ fulfillment
âââ dbtools
âââ load
âââ orders
âââ payment
âââ storefront
âââ user
./deploy
: Collection of application deployment resources./src
: MuShop individual service code, Dockerfile, etc.oci
command line
interface. Follow these instructions to connect to an OKE cluster:
TIP: Use the OCI Cloud Shell with pre-installedoci
andkubectl
TIP: Use kubectx to switch context easily & often from the command line
oci os ns get
oci ce cluster create-kubeconfig \
--cluster-id ocid1.cluster.oc1.iad.aaaaaaaaabbbbbbbbdddddddd...xxx \
--file $HOME/.kube/config --region us-ashburn-1 --token-version 2.0.0
kubectl
context:
kubectl config current-context
# cluster-c4daylfgvrg
kubectl
namespace to skip adding --namespace <name>
to every command:
TIP: use kubens to switch namespace easily & often from the command line
kubectl create namespace mushop
kubectl config set-context \
--current --namespace=mushop
kubectl create namespace <your_name>
kubectl config set-context \
--current --namespace=<your_name>
setup
, which includes several
recommended installations on the cluster. These installations represent
common 3rd party services, which integrate with Oracle Cloud Infrastructure
or enable certain application features.
Chart | Purpose | Option |
---|---|---|
Prometheus | Service metrics aggregation | prometheus.enabled |
Grafana | Infrastructure/service visualization dashboards | grafana.enabled |
Metrics Server | Support for Horizontal Pod Autoscaling | metrics-server.enabled |
Ingress Nginx | Ingress controller and public Load Balancer | ingress-nginx.enabled |
Service Catalog | Service Catalog chart utilized by Oracle Service Broker | catalog.enabled |
kubectl
context:
kubectl config current-context
namespace
for MuShop utilities:
kubectl create namespace mushop-utilities
helm
:
helm dependency update deploy/complete/helm-chart/setup
helm install mushop-utils deploy/complete/helm-chart/setup \
--namespace mushop-utilities
â ī¸ It is possible that certain services may conflict with pre-existing installs.
If so, try setting--set <chart>.enabled=false
for any conflicting charts.
Part of the cluster setup includes the installation of an nginx ingress controller. This resource exposes an OCI load balancer, with a public ip address mapped to the OKE cluster.
By default, the mushop
helm chart creates an Ingress resource, routing
ALL traffic on that ip address to the svc/edge
component.
This is OK for simple scenarios, however it may be desired to differentiate ingress traffic, using host
names on the same ip address. (for example multiple applications on the cluster)
TLDR; Configure the mushop
helm chart ingress values in cases where
traffic must be differentiated from one service to another:
EXTERNAL-IP
assigned to the ingress controller:
kubectl get svc \
mushop-utils-ingress-nginx-controller \
--namespace mushop-utilities
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mushop-utils-ingress-nginx-controller LoadBalancer 10.96.150.230 129.xxx.xxx.xxx 80:30195/TCP,443:31059/TCP 1d
/etc/hosts
entry on your computer with this ip address:
# MuShop ingress load balancer
# EXTERNAL-IP MuShop DNS name
129.xxx.xxx.xxx yourname.mushop.com
Windows users follow a process as described here
myvalues.yaml
(Optional):
# Configure ingress...
ingress:
hosts:
- yourname.mushop.com
helm
provides a way of packaging and deploying configurable
charts, next we will deploy the application in "mock mode" where cloud services are
mocked, yet the application is fully functional
â ī¸ NOTE: Ensure setup steps were completed, and any prior installations are removed
helm install mushop \
deploy/complete/helm-chart/mushop \
--set global.mock.service="all"
helm install mushop \
deploy/complete/helm-chart/mushop \
--set global.mock.service="all" \
--set ingress.hosts[0]="yourname.mushop.com"
########################################
__ __ _____ _
| \/ | / ____| |
| \ / |_ _| (___ | |__ ___ _ __
| |\/| | | | |\___ \| '_ \ / _ \| '_ \
| | | | |_| |____) | | | | (_) | |_) |
|_| |_|\__,_|_____/|_| |_|\___/| .__/
| |
|_|
########################################
kubectl get pod --watch
â˛ī¸ It may take a few moments to download all the application images.
helm install
,
go ahead and launch the application in your browser.
EXTERNAL-IP
assigned to the ingress controller:
kubectl get svc \
mushop-utils-ingress-nginx-controller \
--namespace mushop-utilities
Open the IP address in your browser
kubectl
configured on localhost
kubectl port-forward \
svc/edge 8000:80
template
command:
mkdir ./out
helm template mushop deploy/complete/helm-chart/mushop \
--set global.mock.service="all" \
--output-dir ./out
Explore the files, and see each output. Example:
# Source: mushop/charts/api/templates/api-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: mushop-api
labels:
app.kubernetes.io/name: api
helm.sh/chart: api-0.1.0
app.kubernetes.io/instance: mushop
layer: client
app.kubernetes.io/version: "0.1.0"
app.kubernetes.io/managed-by: Tiller
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: api
app.kubernetes.io/instance: mushop
layer: client
template:
metadata:
labels:
app.kubernetes.io/name: api
app.kubernetes.io/instance: mushop
layer: client
spec:
containers:
- name: api
image: "iad.ocir.io/oracle/ateam/mushop-api:2.0.0"
imagePullPolicy: Always
ports:
- name: http
containerPort: 3000
env:
- name: MOCK_MODE
value: "all"
- name: SESSION_REDIS
value: mushop-session
- name: CATALOGUE_URL
value: http://mushop-catalogue
- name: ORDERS_URL
value: http://mushop-orders
- name: CARTS_URL
value: http://mushop-carts
- name: USERS_URL
value: http://mushop-user
- name: STATIC_MEDIA_URL
value: ""
livenessProbe:
httpGet:
path: /health
port: http
readinessProbe:
httpGet:
path: /health
port: http
resources:
limits:
cpu: 300m
memory: 300Mi
requests:
cpu: 100m
memory: 100Mi
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
helm
to list the releases in the namespace:
helm list
Expect output like the following:
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
mushop mushop 1 2020-05-06 14:40:37.615416 -0600 MDT deployed mushop-0.1.01.0
mushop
release:
helm delete mushop