updates for OpenShift
This commit is contained in:
@@ -4,17 +4,30 @@ See the official [documentation](https://docs.instana.io/quick_start/agent_setup
|
||||
|
||||
# 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.
|
||||
For OpenShift run the `setup.sh` script to create the project and set the extra permissions.
|
||||
|
||||
Run the *setup.sh* script first, you will need the passwords for the developer and system:admin users.
|
||||
Use the Helm chart for Kubernetes to install Stan's Robot Shop. To install on Minishift.
|
||||
|
||||
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.
|
||||
### Helm 3
|
||||
|
||||
When the deployment has completed, to make Stan's Robot Shop accessible the web service needs to be updated.
|
||||
|
||||
```bash
|
||||
oc edit svc web
|
||||
```shell
|
||||
$ cd K8s
|
||||
$ oc login -u developer
|
||||
$ oc project robot-shop
|
||||
$ helm install robot-shop --set openshift=true --set nodeport=true helm
|
||||
```
|
||||
|
||||
Change *type* to **NodePort** when running on Minishift or **LoadBalancer** for regular OpenShift.
|
||||
To connect to the shop.
|
||||
|
||||
```shell
|
||||
$ minishift ip
|
||||
192.168.99.106
|
||||
$ oc get svc web
|
||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
web NodePort 172.30.180.253 <none> 8080:31147/TCP 4m
|
||||
```
|
||||
|
||||
Use the IP and the node port to form the URL `http://192.168.99.106:31147/`
|
||||
|
||||
|
||||
|
||||
|
@@ -1,48 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# set -x
|
||||
|
||||
set -e
|
||||
|
||||
# Put your EUM key here
|
||||
EUM_KEY=""
|
||||
|
||||
|
||||
echo "logging in as developer"
|
||||
oc login -u developer
|
||||
oc project robot-shop
|
||||
|
||||
# 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
|
||||
NAME=$(echo "$LINE" | cut -d: -f1)
|
||||
IMAGE=$(echo "$LINE" | cut -d: -f2-)
|
||||
FULL_IMAGE=$(eval "echo $IMAGE")
|
||||
|
||||
echo "NAME $NAME"
|
||||
echo "importing $FULL_IMAGE"
|
||||
|
||||
oc import-image $FULL_IMAGE --from $FULL_IMAGE --confirm
|
||||
# a bit of a hack but appears to work
|
||||
BASE=$(basename $FULL_IMAGE)
|
||||
oc new-app -i $BASE --name $NAME
|
||||
done
|
||||
|
||||
# Set EUM environment if required
|
||||
if [ -n "$EUM_KEY" ]
|
||||
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 " "
|
||||
|
@@ -1,28 +1,12 @@
|
||||
#!/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 new-project robot-shop
|
||||
oc adm policy add-role-to-user admin developer -n robot-shop
|
||||
oc adm policy add-scc-to-user anyuid -z default
|
||||
oc adm policy add-scc-to-user privileged -z default
|
||||
|
||||
oc logout
|
||||
|
||||
echo " "
|
||||
echo "OpenShift set up complete, ready to deploy Robot Shop now."
|
||||
echo " "
|
||||
oc login -u developer
|
||||
|
||||
|
Reference in New Issue
Block a user