OCP
Managing Persistent Volumes:
apiVersion: v1
kind: PersistentVolume
metadata:
name: strickland-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
nfs:
path: /home/data/persistent01
server: ip-10-0-2-206.ec2.internal
persistentVolumeReclaimPolicy: Recycle
oc process openshift//mariadb-persistent --parameters
oc new-app --template=mariadb-persistent --param=MYSQL_USER=optimoz \
--param=MYSQL_PASSWORD=pass123 --param=MYSQL_DATABASE=optimoz --param=MYSQL_ROOT_PASSWORD=pass123
Registry Volume:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: registry-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
Create a PV and PVC
oc volume dc/docker-registry --add --name=registry-storage -t pvc --claim-name=registry-pvc --overwrite
Create a secure route:
oc new-project atmos —description=“Atmos”
oc new-app centos/ruby-25-centos7~https://github.com/sclorg/ruby-ex.git --name="atmos"
./gen-certs.sh atmos.atmos.10.0.2.204.xip.io
oc create route edge --service=atmos --cert=atmos.atmos.10.0.2.204.xip.io.crt --key=atmos.atmos.10.0.2.204.xip.io.key --hostname=atmos.atmos.10.0.2.204.xip.io
Install Metrics:
Create a 10Gi PV
apiVersion: v1
kind: PersistentVolume
metadata:
name: metrics-pv
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
nfs:
path: /home/data/persistent04
server: ip-10-0-2-206.ec2.internal
persistentVolumeReclaimPolicy: Recycle
/etc/ansibe/hosts
openshift_metrics_install_metrics=True
openshift_metrics_hawkular_hostname=hawkular-metrics-openshift-infra.10.0.2.204.xip.io
openshift_metrics_cassandra_storage_type=pv
openshift_metrics_hawkular_limits_cpu=200m
openshift_metrics_hawkular_requests_cpu=200m
openshift_metrics_hawkular_requests_memory=1Gi
openshift_metrics_heapster_limits_memory=1Gi
openshift_metrics_heapster_requests_memory=1Gi
openshift_metrics_hawkular_nodeselector={"region":"infra"}
openshift_metrics_heapster_nodeselector={"region":"infra"}
openshift_metrics_cassandra_nodeselector={"region":"infra"}
openshift_metrics_image_version=v3.9
ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-metrics/config.yml
Create App from a 3rd Party Template:
oc create -f template.yml
oc process openshift//gogs —parameters
oc new-app --template=gogs --param=DATABASE_VERSION=9.4 --param=HOSTNAME=gogs.atmos.okd.10.0.2.204.xip.io
ResourceQuota and LimitRange:
apiVersion: v1
kind: ResourceQuota
metadata:
name: c3h8
spec:
hard:
configmaps: "5"
persistentvolumeclaims: "2"
services: "5"
apiVersion: v1
kind: LimitRange
metadata:
name: probot-rl
spec:
limits:
- type: "Pod"
max:
cpu: "2"
memory: "1Gi"
min:
cpu: "200m"
memory: "6Mi"
- type: "Container"
max:
cpu: "2"
memory: "1Gi"
min:
cpu: "100m"
memory: "4Mi"
default:
cpu: "300m"
memory: "200Mi"
defaultRequest:
cpu: "200m"
memory: "100Mi"
maxLimitRequestRatio:
cpu: "10"
Create a new app, make a change and rebuild:
oc new-app openshift/hello-openshift --name=howdy
oc start-build bc/bc-name
Scale up replicas:
oc scale --replicas=5 dc/howdy
User Management
oc new-project atmos —description=“Atmos”
htpasswd -b /etc/origin/master/htpasswd user1 pass123
oc groups new atoms-group user1 user2 user2
oc describe rolebinding.rbac -n megalomart
oc adm policy remove-cluster-role-from-group self-provisioner system:authenticated system:authenticated:oauth
oc annotate clusterrolebinding.rbac self-provisioner ‘rbac.authorization.kubernetes.io/autoupdate=false’ –overwrite