Red Hat OpenShift Container Platform 4.x
OpenShift, Red Hat'in kurumsal Kubernetes dağıtımıdır. CI/CD, monitoring ve güvenlik özellikleri entegre gelir.
OpenShift 4.x Mimarisi
- Control Plane: API Server, etcd, Scheduler, Controller Manager
- Worker Nodes: Container workload'ların çalıştığı nodelar
- Infrastructure Nodes: Router, Registry, Monitoring
IPI Kurulum (Installer-Provisioned Infrastructure)
# OpenShift installer indirme
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux.tar.gz
tar xvf openshift-install-linux.tar.gz
install-config.yaml oluşturma
./openshift-install create install-config --dir=cluster
install-config.yaml düzenleme
vi cluster/install-config.yaml
Cluster kurulumu başlatma
./openshift-install create cluster --dir=cluster --log-level=info
Kurulum tamamlandığında
export KUBECONFIG=cluster/auth/kubeconfig
Cluster Yönetimi
# Node durumu
oc get nodes
oc describe node worker-0
Cluster version
oc get clusterversion
oc get co # Cluster Operators
Proje/Namespace yönetimi
oc new-project myapp
oc project myapp
oc get projects
Uygulama Deployment
# Deployment oluşturma
oc create deployment webapp --image=nginx:latest --replicas=3
Service expose etme
oc expose deployment webapp --port=80
Route oluşturma (external erişim)
oc expose svc webapp
Deployment durumu
oc get pods
oc get deployment
oc get svc
oc get route
OperatorHub Kullanımı
# Operator listesi
oc get packagemanifest -n openshift-marketplace
Operator subscription oluşturma
cat << EOF | oc apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: elasticsearch-operator
namespace: openshift-operators
spec:
channel: stable
name: elasticsearch-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
EOF
Monitoring ve Logging
# Prometheus erişimi
oc port-forward -n openshift-monitoring svc/prometheus-k8s 9090:9090
Cluster logging
oc get pods -n openshift-logging
Pod logları
oc logs -f deployment/webapp
Sonuç
OpenShift 4.x, kurumsal Kubernetes ihtiyaçlarını karşılayan tam bir platformdur. Operator pattern ile Day-2 operasyonları otomatize edilir.