Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 1.31 KB

File metadata and controls

58 lines (45 loc) · 1.31 KB

Task 17: Sidecar with Workload Selector in Coral Namespace

Step 1: Switch to Correct Context

kubectl config use-context cluster3-admin@cluster3

Step 2: Create Sidecar with Workload Selector

kubectl apply -f - <<'EOF'
apiVersion: networking.istio.io/v1
kind: Sidecar
metadata:
  name: default
  namespace: coral
spec:
  workloadSelector:
    labels:
      app: space
  egress:
  - hosts:
    - "lime/*"
    - "turquoise/*"
    - "istio-system/*"
EOF

Verification

# Check Sidecar configuration
kubectl get sidecar -n coral
kubectl describe sidecar default -n coral

# Verify workload selector
kubectl get sidecar default -n coral -o jsonpath='{.spec.workloadSelector}'

Testing

# Verify the Sidecar was applied to pods with app=space label
kubectl get pods -n coral -l app=space

# Check that space pods exist and have sidecars
kubectl get pods -n coral -l app=space -o jsonpath='{.items[0].metadata.name}'

# Verify the Sidecar configuration is correct
kubectl get sidecar default -n coral -o yaml

# Verify workload selector targets app=space
kubectl get sidecar default -n coral -o jsonpath='{.spec.workloadSelector.labels}'

# Verify egress hosts include lime, turquoise, and istio-system
kubectl get sidecar default -n coral -o jsonpath='{.spec.egress[*].hosts[*]}'