Name Type Data apps (same as parent folder) Start of Authority (SOA) [16], dc-infra.habra.cloud, (same as parent folder) Name Server (NS) 172.28.246.50. ansible Host (A) 172.28.247.200 master Host (A) 172.28.247.211 nfs Host (A) 172.28.247.51 node01 Host (A) 172.28.247.212 node02 Host (A) 172.28.247.213
Name Type Data Timestamp * Host (A) 172.28.247.211 static
root@master# hostname master.habra.cloud
root@OpenShiftCluster# cat /etc/resolv.conf # Generated by NetworkManager search habra.cloud default.svc.cluster.local svc.cluster.local cloud.local default.svc svc local nameserver 172.28.246.50
root@OpenShiftCluster# yum -y install docker
OPTIONS='--selinux-enabled --insecure-registry 172.30.0.0/16'
root@OpenShiftCluster# fdisk /dev/sdb n t 8e w root@OpenShiftCluster# pvcreate /dev/sdb1 root@OpenShiftCluster# vgcreate docker-vg /dev/sdb1
# Edit this file to override any configuration options specified in # /usr/lib/docker-storage-setup/docker-storage-setup. # # For more details refer to "man docker-storage-setup" VG=docker-vg
root@OpenShiftCluster# docker-storage-setup
root@OpenShiftCluster# systemctl is-active docker
root@OpenShiftCluster# systemctl enable docker root@OpenShiftCluster# systemctl start docker
root@OpenShiftCluster# systemctl stop docker root@OpenShiftCluster# rm -rf /var/lib/docker/* root@OpenShiftCluster# systemctl restart docker
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of these three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
root@OpenShiftCluster# setsebool -P virt_use_nfs 1 root@OpenShiftCluster# setsebool -P virt_sandbox_use_nfs 1
root@OpenShiftCluster# yum install -y wget git net-tools bind-utils iptables-services bridge-utils bash-completion nfs-utils nfs-utils-lib root@OpenShiftCluster# yum update root@OpenShiftCluster# yum -y install \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm root@OpenShiftCluster# sed -i -e "s/^enabled=1/enabled=0/" /etc/yum.repos.d/epel.repo root@OpenShiftCluster# yum -y --enablerepo=epel install pyOpenSSL
root@master# yum -y --enablerepo=epel install ansible pyOpenSSL
root@nfs# mkdir -R /nfs/infrastructure/registry root@nfs# chmod 755 /nfs/infrastructure root@nfs# chmod 755 /nfs/infrastructure/registry root@nfs# chown nfsnobody:nfsnobody /nfs/infrastructure root@nfs# chown nfsnobody:nfsnobody /nfs/infrastructure/registry
/nfs/infrastructure/registry *(rw,sync,root_squash,no_subtree_check,no_wdelay)
root@nfs# exportfs -a
root@ansible# for host in master.habra.cloud \ node01.habra.cloud \ node02.habra.cloud; \ do ssh-copy-id -i ~/.ssh/id_rsa.pub $host; \ done
root@ansible# cat inventory [OSEv3:children] masters nodes [masters] master.habra.cloud [nodes] master.habra.cloud openshift_schedulable=false openshift_node_labels="{'region': 'infra', 'zone': 'default'}" node01.habra.cloud openshift_node_labels="{'region': 'primary', 'zone': 'firstzone'}" node02.habra.cloud openshift_node_labels="{'region': 'primary', 'zone': 'secondzone'}" [OSEv3:vars] ansible_ssh_user=root openshift_master_default_subdomain=apps.habra.cloud containerized=false deployment_type=origin
root@ansible# git clone https://github.com/openshift/openshift-ansible
root@ansible# ansible-playbook -i ./inventory openshift-ansible/playbooks/byo/config.yml
root@master# oc get nodes NAME STATUS AGE master.habra.cloud Ready,SchedulingDisabled 1d node01.habra.cloud Ready 1d node02.habra.cloud Ready 1d
root@master# oadm manage-node master.habra.cloud --schedulable=true root@master# oc get nodes NAME STATUS AGE master.habra.cloud Ready 1d node1.habra.cloud Ready 1d node2.habra.cloud Ready 1d
root@master# oc project default root@master# oc get all NAME REVISION DESIRED CURRENT TRIGGERED BY dc/docker-registry 4 1 1 config dc/router 3 1 1 config NAME DESIRED CURRENT READY AGE rc/docker-registry-1 0 0 0 1d rc/router-1 1 1 1 1d NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE svc/docker-registry 172.30.7.135 <none> 5000/TCP 1d svc/kubernetes 172.30.0.1 <none> 443/TCP,53/UDP,53/TCP 1d svc/router 172.30.79.17 <none> 80/TCP,443/TCP,1936/TCP 1d NAME READY STATUS RESTARTS AGE po/docker-registry-1-ayuuo 1/1 Running 11 1d po/router-1-lzewh 1/1 Running 8 1d
apiVersion: v1 kind: PersistentVolume metadata: name: registrypv spec: capacity: storage: 20Gi accessModes: - ReadWriteOnce nfs: path: /nfs/infrastructure/registry server: nfs.habra.cloud persistentVolumeReclaimPolicy: Recycle
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: registry-claim1 spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Gi
root@master# oc create -f nfs-pv.yaml
root@master# oc get pv NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS ... registrypv 20Gi RWO Recycle Available
root@master# oc create -f nfs-claim1.yaml root@master# oc get pvc NAME STATUS VOLUME CAPACITY ACCESSMODES AGE registry-claim1 Bound registrypv 20Gi RWO 1d
root@master# oc volume deploymentconfigs/docker-registry --add --name=registry-storage -t pvc \ --claim-name=registry-claim1 --overwrite
root@master# oc get pods NAME READY STATUS RESTARTS AGE docker-registry-2-sdfhk 1/1 Running 1 1d
# Reverse DNS record for master host-record=master.habra.cloud,172.28.247.211 # Wildcard DNS for OpenShift Applications - Points to Router server=/habra.cloud/172.28.246.50 address=/apps.habra.cloud/172.28.247.211 server=/apps.habra.cloud/172.28.246.50 # Forward .local queries to SkyDNS server=/local/127.0.0.1#8053 # Forward reverse queries for service network to SkyDNS. # This is for default OpenShift SDN - change as needed. server=/17.30.172.in-addr.arpa/127.0.0.1#8053 # Forward .habra.cloud queries to DC server=/habra.cloud/172.28.246.50#53
dnsConfig: bindAddress: 0.0.0.0:8053
root@master# service dnsmasq restart root@master# service origin-master restart
Source: https://habr.com/ru/post/324240/
All Articles