deployment tweaks

This commit is contained in:
Steve Waterworth
2019-03-05 15:49:11 +00:00
parent e397725db7
commit 4bcb5dcaee
5 changed files with 59 additions and 144 deletions

20
OpenShift/README.md Normal file
View File

@@ -0,0 +1,20 @@
# Instana Agent Installation
See the official [documentation](https://docs.instana.io/quick_start/agent_setup/container/openshift/) for how to install the Instana agent on an OpenShift environment.
# Robot Shop Deployment
Have a look at the contents of the *setup.sh* and *deploy,sh* scripts, you may want to tweak some settings to suit your environment.
Run the *setup.sh* script first, you will need the passwords for the developer and system:admin users.
Once the set up is completed, run the *deploy.sh* script. This script imports the application images from Docker Hub into OpenShift, then it creates applications from those images.
When the deployment has completed, to make Stan's Robot Shop accessible the web service needs to be updated.
```bash
oc edit svc web
```
Change *type* to **NodePort** when running on Minishift or **LoadBalancer** for regular OpenShift.

View File

@@ -1,18 +0,0 @@
#!/bin/sh
if [ "$1" = "p" ]
then
YAML=instana-agent-os-private.yaml
else
YAML=instana-agent-os.yaml
fi
oc login -u system:admin
oc create -f $YAML
oc project instana-agent
oc adm policy add-scc-to-user privileged -z instana-admin
oc label node localhost agent=instana
oc adm policy add-role-to-user admin developer -n instana-agent
oc login -u developer

View File

@@ -1,30 +1,23 @@
#!/bin/sh
# set -x
set -e
# Put your EUM key here
EUM_KEY=""
# set -x
# This only works for default local install of minishift
# Need to tweak some settings in OpenShift
oc login -u developer
oc new-project robot-shop
oc login -u system:admin
oc adm policy add-scc-to-user anyuid system:serviceaccount:robot-shop:default
echo "logging in as developer"
oc login -u developer
oc project robot-shop
echo "OpenShift set up complete, ready to deploy Robot Shop now."
/bin/echo -n "Enter to continue: "
read CONTINUE
# set the environment from the .env file
for VAR in $(egrep '^[A-Z]+=' ../.env)
do
export $VAR
done
# import all the images from docker hub into OpenShift
for LINE in $(awk '/^ {2}[a-z]+:$/ {printf "%s", $0} /image: / {print $2}' ../docker-compose.yaml)
do
@@ -47,3 +40,9 @@ then
oc set env dc/web INSTANA_EUM_KEY=$EUM_KEY
fi
echo " "
echo "Deployment complete"
echo "To make Robot Shop accessible, please run <oc edit svc web>"
echo "Change type from ClusterIP to NodePort on minishift or LoadBalancer on OpenShift"
echo " "

View File

@@ -1,114 +0,0 @@
apiVersion: v1
kind: List
items:
- kind: Namespace
apiVersion: v1
metadata:
name: instana-agent
labels:
name: instana-agent
- apiVersion: v1
kind: ServiceAccount
metadata:
name: instana-admin
namespace: instana-agent
- apiVersion: v1
kind: Secret
metadata:
name: instana-agent-secret
namespace: instana-agent
data:
key: <your base64 encoded key here>
- apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
labels:
app: instana-agent
name: instana-agent
namespace: instana-agent
spec:
selector:
matchLabels:
app: instana-agent
template:
metadata:
labels:
app: instana-agent
spec:
nodeSelector:
agent: instana
hostIPC: true
hostNetwork: true
hostPID: true
containers:
- name: instana-agent
image: instana/agent
imagePullPolicy: Always
env:
- name: INSTANA_ZONE
value: Stans-Robot-Shop
- name: INSTANA_AGENT_ENDPOINT
value: saas-us-west-2.instana.io
- name: INSTANA_AGENT_ENDPOINT_PORT
value: '443'
- name: INSTANA_AGENT_HTTP_LISTEN
value: '*'
- name: INSTANA_AGENT_KEY
valueFrom:
secretKeyRef:
name: instana-agent-secret
key: key
securityContext:
privileged: true
volumeMounts:
- name: dev
mountPath: /dev
- name: run
mountPath: /var/run/docker.sock
- name: sys
mountPath: /sys
- name: log
mountPath: /var/log
livenessProbe:
exec:
command:
- echo
- noop
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 5
readinessProbe:
exec:
command:
- echo
- noop
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 5
resources:
requests:
memory: "256Mi"
cpu: "0.2"
limits:
memory: "512Mi"
cpu: "0.5"
volumes:
- name: dev
hostPath:
path: /dev
- name: run
hostPath:
path: /var/run/docker.sock
- name: sys
hostPath:
path: /sys
- name: log
hostPath:
path: /var/log
serviceAccount: instana-admin

28
OpenShift/setup.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
# Put your EUM key here
EUM_KEY=""
# set -x
# This only works for default local install of minishift
# Need to tweak some settings in OpenShift
echo "logging in as system:admin"
oc login -u system:admin
# Optionally label the nodes with role infra
for NODE in $(oc get node | awk '{if ($3 == "infra" || $3 == "<none>") print $1}' -)
do
oc label node $NODE 'type=infra'
done
oc adm new-project robot-shop --node-selector='type=infra'
oc adm policy add-role-to-user admin developer -n robot-shop
oc adm policy add-scc-to-user anyuid system:serviceaccount:robot-shop:default
oc logout
echo " "
echo "OpenShift set up complete, ready to deploy Robot Shop now."
echo " "