<p>I have written a custom resource as part of the deployment. As part of this in the reconcileKind function, I have written the logic to create pod as shown below using the Kubernetes APIs in Go itself.</p>
<p><a href="https://i.stack.imgur.com/bEQUu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bEQUu.png" alt="Image" /></a></p>
<p>I would like to convert this to knative serving (instead of creating the POD which will be always running) so that I can make of KPA feature. I am aware of creating knative serving using the .yaml way. But I would like to create it by using the Kubernetes API itself. I did search in the official documentation, but everything explained was using the .yaml way.</p>
<p>So I'm curious whether can we achieve knative serving by directly using Kubernetes APIs?</p>

coders
<blockquote>
<p>How to create the knative serving using golang?</p>
</blockquote>
<p>You need to use the Go-client for Knative Serving, e.g. the client type - corresponding to the <code>corev1.Pod</code> that you used in your code.</p>
<p>The Go client for <a href="https://github.com/knative/serving/blob/master/pkg/client/clientset/versioned/clientset.go" rel="nofollow noreferrer">Knative v1.Serving</a> is in the Knative repository.</p>
<p>Instead of <code>CoreV1()</code> in your code, you can use <code>ServingV1()</code> from the Knative Go client.</p>
<p>But I would recommend to use Yaml manifests unless you have custom needs.</p>
