Skip to content

Debug Kubernetes Issues #15

Debug Kubernetes Issues

Debug Kubernetes Issues #15

name: Debug Kubernetes Issues
on:
workflow_dispatch:
inputs:
namespace:
description: "Namespace to deploy to"
required: false
default: "troubleshooting"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure Kubernetes cluster
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
chmod 600 ~/.kube/config
- name: Create Kubernetes YAML file
run: |
cat << 'EOF' > interview-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: interview-app
namespace: ${{ github.event.inputs.namespace || 'troubleshooting' }}
spec:
replicas: 1
selector:
matchLabels:
app: interview
template:
metadata:
labels:
app: interview
spec:
dnsPolicy: ClusterFirst
dnsConfig:
nameservers:
- '8.8.8.8'
searches:
- ${{ github.event.inputs.namespace || 'troubleshooting' }}.svc.cluster.local
options:
- name: ndots
value: '2'
containers:
- name: main
image: becloudready/k8s-troubleshooting-scenarios:5.0.0
command: ['python3', '/app/troubleshoot_scenarios.py']
volumeMounts:
- name: config-volume
mountPath: /etc/app
resources:
limits:
memory: '256Mi'
cpu: '500m'
volumes:
- name: config-volume
configMap:
name: app-config
items:
- key: config.yml
path: config.yaml
---
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
namespace: ${{ github.event.inputs.namespace || 'troubleshooting' }}
data:
config.yml: |
database:
host: db-service
port: 5432
logging:
level: debug
EOF
- name: Apply Deployment and ConfigMap to Kubernetes
run: |
kubectl apply -f interview-deployment.yaml
- name: Run Kubernetes Troubleshooting Action
uses: becloudready/k8s-interview-action@v3
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
namespace: ${{ github.event.inputs.namespace || 'troubleshooting' }}