<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 KFServing Knative Logger Demo
We create a message dumper Knative service to print out CloudEvents it receives
Step1:  Create a channel broker.
Step2:  Create a Knative trigger to pass events to the message logger.
Step3:  Create an sklearn model with associated logger to push events to the message logger URL.
<ASSISTANT_TASK:>
Python Code:
!pygmentize message-dumper.yaml
!kubectl apply -f message-dumper.yaml
Explanation: KFServing Knative Logger Demo
We create a message dumper Knative service to print out CloudEvents it receives:
End of explanation
!pygmentize broker.yaml
!kubectl create -f broker.yaml
Explanation: Create a channel broker.
End of explanation
!pygmentize trigger.yaml
!kubectl apply -f trigger.yaml
Explanation: Create a Knative trigger to pass events to the message logger.
End of explanation
!pygmentize sklearn-logging.yaml
!kubectl apply -f sklearn-logging.yaml
CLUSTER_IPS=!(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
CLUSTER_IP=CLUSTER_IPS[0]
print(CLUSTER_IP)
SERVICE_HOSTNAMES=!(kubectl get inferenceservice sklearn-iris -o jsonpath='{.status.url}' | cut -d "/" -f 3)
SERVICE_HOSTNAME=SERVICE_HOSTNAMES[0]
print(SERVICE_HOSTNAME)
import requests
def predict(X, name, svc_hostname, cluster_ip):
    formData = {
    'instances': X
    }
    headers = {}
    headers["Host"] = svc_hostname
    res = requests.post('http://'+cluster_ip+'/v1/models/'+name+':predict', json=formData, headers=headers)
    if res.status_code == 200:
        return res.json()
    else:
        print("Failed with ",res.status_code)
        return []
predict([[6.8,  2.8,  4.8,  1.4]],"sklearn-iris",SERVICE_HOSTNAME,CLUSTER_IP)
!kubectl logs  $(kubectl get pod -l serving.knative.dev/configuration=message-dumper -o jsonpath='{.items[0].metadata.name}') user-container
!kubectl delete -f sklearn-logging.yaml
!kubectl delete -f trigger.yaml
!kubectl delete -f message-dumper.yaml
Explanation: Create an sklearn model with associated logger to push events to the message logger URL.
End of explanation
<END_TASK>