OpenShift Interview Questions and Answers
1. How do you display or show the current IP ranges for services and pods in your OCP cluster?
oc get networks.operator.openshift.io cluster -o jsonpath='{.spec.clusterNetwork[*].cidr}'
oc get networks.operator.openshift.io cluster -o jsonpath='{.spec.serviceNetwork[*]}'
2. How do you configure Egress and Namespace Egress for OpenShift?
Assign the label to nodes and create an EgressIP object:
oc label node <node-name> egress-assignable=
apiVersion: k8s.ovn.org/v1
kind: EgressIP
metadata:
name: example-egressip
spec:
egressIPs:
- 192.168.1.100
namespaceSelector:
matchLabels:
app: mynamespace
podSelector: {}
3. How do you check which version of your OpenShift cluster?
oc version
oc get clusterversion
4. What kind of authentication method is used for authenticating OpenShift?
OpenShift supports OAuth-based authentication, LDAP, and OpenID Connect. Check the configuration:
oc get oauth cluster -o yaml
5. How do you troubleshoot the connectivity from POD to POD?
oc rsh <pod-name> ping <destination-pod-IP>
oc get networkpolicy -A
oc debug node/<node-name> -- chroot /host
6. How do you configure routes to run on a specific set of nodes, for example, infra nodes?
oc label node <node-name> node-role.kubernetes.io/infra=
oc patch ingresscontroller default -n openshift-ingress-operator --type merge -p '
{
"spec": {
"nodePlacement": {
"nodeSelector": {
"matchLabels": {
"node-role.kubernetes.io/infra": ""
}
}
}
}
}'
7. How do you make sure that you have a dedicated node for the infrastructure components?
oc label node <infra-node> node-role.kubernetes.io/infra=
oc adm taint nodes <infra-node> node-role.kubernetes.io/infra:NoSchedule
8. What is the best monitoring tool to be used for OpenShift monitoring?
Prometheus and Grafana are the best tools for monitoring OpenShift.
9. How do you configure an alert in Prometheus?
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: custom-alerts
namespace: openshift-monitoring
spec:
groups:
- name: custom-rules
rules:
- alert: HighMemoryUsage
expr: node_memory_Active_bytes > 80
for: 5m
labels:
severity: critical
annotations:
summary: "High Memory Usage"
oc apply -f custom-alert.yaml
10. What are the best logging tools for OpenShift?
Fluentd, Elasticsearch, Kibana, and Loki are popular logging tools for OpenShift.
11. How does the logging stack work in OpenShift?
OpenShift uses Fluentd for log collection, Elasticsearch for storage, Kibana for visualization, and Curator for log management.
12. How is the OpenShift upgrade done?
oc get clusterversion
oc adm upgrade --to-latest
watch oc get clusterversion
13. What are the diagnostic tools for collecting logs and uploading them for support?
oc adm must-gather
oc logs -n openshift-logging
oc get events -A
oc adm inspect clusteroperators --dest-dir=<path>

0 Comments