Configurar el entorno

En estos pasos se describe cómo configurar el entorno antes de instalar Oracle Cloud Native Environment en Oracle Private Cloud Appliance.

Suponemos que ya se han aprovisionado los siguientes recursos:

  • Un compartimento en el arrendamiento.
  • Una red virtual en la nube (VCN) en el compartimento con una etiqueta DNS (con Usar nombres de host de DNS activado en esta VCN).
  • Instancias informáticas para tres nodos de trabajador, un nodo de control y un nodo de operador.

Definir Proxy

Defina el proxy vars in etc bashrc en todos los nodos para que todas las sesiones de shell futuras tengan las ventajas de las variables de entorno de proxy. Sustituya el nombre y el puerto del servidor proxy adecuados por: http://proxy-host:proxy-port.

if [ ! -f /etc/bashrc.bak ]; then
 cp -p /etc/bashrc /etc/bashrc.bak
else
 cp -p /etc/bashrc.bak /etc/bashrc
fizz=/tmp/ocne.setup.sh.on_host_to_be_setup
cat <<EOD > $zz
export http_proxy=http://proxy-host:proxy-port
export https_proxy=http://proxy-host:proxy-port
# substitute your domain name for "dm.com"
HOSTNAME=`hostname`
first_3_octets_of_LAN=`nslookup $HOSTNAME.dm.com | grep Address | tail -1 | sed -e 's/Address: //' -e 's/\.[0-9]*$//'`
export 
no_proxy='localhost,127.0.0.1,.proxy-host,.oraclecorp.com,.oraclevcn.com,$first_3_octets_of_LAN.0/24,.svc,/var/run/crio/crio.sock,10.96.0.0/12'EOD
cat $zz >> /etc/bashrc

Aplicar actualizaciones de SO

Aplique parches del sistema operativo para actualizar la seguridad y la función de todos los nodos.

Identifique el sistema operativo.

Identify Oracle Linux major release 
uname -a | sed -e 's/.*\.el//' -e 's/^\(.\).*/\1/'

Si el resultado de este comando es 8, está ejecutando Oracle Linux 8. Si ejecuta Oracle Linux 7, utilice yum en lugar de dnf y no transfiera el argumento adicional --best --allowerasing.

Por ejemplo, si las instrucciones dicen:

yum --setopt=keepcache=1 xyz

En su lugar, si se ejecuta en Oracle Linux 7, debe ejecutar el comando:

dnf --best --setopt=keepcache=1 --allowerasing xyz

Aplique actualizaciones del sistema operativo en todos los nodos después de configurar yum y, posiblemente, dnf para conocer el servidor proxy.

if [ ! -f /etc/yum.conf.bak ]; then
 cp /etc/yum.conf /etc/yum.conf.bak
else
 cp /etc/yum.conf.bak /etc/yum.conf
fi
echo proxy=http://proxy-host:proxy-port >> /etc/yum.conf
if [ -d /etc/dnf ]; then
 if [ ! -f /etc/dnf/dnf.conf.bak ]; then
 sudo cp /etc/dnf/dnf.conf /etc/dnf/dnf.conf.bak
 else
 sudo cp /etc/dnf/dnf.conf.bak /etc/dnf/dnf.conf
 fi
 cp /etc/dnf/dnf.conf.bak /tmp/dnf.conf
 echo proxy=http://proxy-host:proxy-port:80 >> /tmp/dnf.conf
 sudo mv /tmp/dnf.conf /etc/dnf/dnf.conf
fi
dnf --best --setopt=keepcache=1 --allowerasing update -y
reboot

Configurar repositorios en todos los nodos

Configure los repositorios yum en todos los nodos.

configure repos 
# if we are on OEL7, do the following:
sudo yum-config-manager --enable ol7_olcne15 ol7_kvm_utils ol7_addons ol7_latest ol7_UEKR6
sudo yum-config-manager --disable ol7_olcne14 ol7_olcne13 ol7_olcne12 ol7_olcne11 ol7_olcne
ol7_developer
# but if we are on Oracle Linux 8, do the following:
sudo dnf -y install oracle-olcne-release-el8
sudo yum config-manager --enable ol8_olcne15 ol8_addons ol8_baseos_latest ol8_appstream 
ol8_UEKR6
sudo yum config-manager --disable ol8_olcne12 ol8_olcne13 ol8_olcne14 ol8_developer

Instalar Chrony

#Install chrony on all nodes.
sudo dnf --best --setopt=keepcache=1 --allowerasing -y install chrony
sudo systemctl enable --now chronyd.service

Desactivar intercambio en todos los nodos

no swap 
swapoff -a
if [ ! -f /etc/fstab.bak ]; then
 sudo cp /etc/fstab /etc/fstab.bak
fi
cat /etc/fstab.bak | sed '/[\t ]swap[\t ]/d' > /tmp/fstab
echo diff /etc/fstab.bak /tmp/fstab
diff /etc/fstab.bak /tmp/fstab
sudo cp /tmp/fstab /etc/fstab
echo cat /etc/fstab
cat /etc/fstab

Configurar firewall en nodo de operador

operator node firewall 
sudo firewall-cmd --add-port=8091/tcp --permanent
sudo firewall-cmd --reload

Configurar firewall en nodos de trabajador

worker node firewall 
sudo firewall-cmd --zone=trusted --add-interface=cni0 --permanent
sudo firewall-cmd --add-port=8090/tcp --permanent
sudo firewall-cmd --add-port=10250/tcp --permanent
sudo firewall-cmd --add-port=10255/tcp --permanent
sudo firewall-cmd --add-port=8472/udp --permanent
sudo firewall-cmd --add-masquerade --permanent
sudo systemctl restart firewalld.service

Configurar regla de entrada de lista de seguridad de subred

Debe ajustar la lista de seguridad de subred para permitir el tráfico de Oracle Cloud Native Environment y Kubernetes en el nuevo cluster.
  1. Aumente detalle en la lista de seguridad para agregar reglas de entrada.
  2. Agregue reglas de entrada a la lista de seguridad de la subred utilizada para las instancias informáticas de los nodos a fin de permitir el tráfico en los puertos necesarios.
  3. Permita el tráfico a los siguientes puertos:
    • 2.379-2.380
    • 6.443-6.444
    • 8.090-8.091
    • 8.472
    • 10.250-10.252
    • 10.255