title: Deploy service to Kubernetes via Go
body: <p>I am trying to write a Go script which will deploy given deployment to K8S cluster. Ideally, I would like the script to do something like this bash:</p>
  
  <pre><code>KUBECONFIG="/kubeconfig" kubectl rollout restart --namespace $k8s_namespace "deployment/${service_name}"
  </code></pre>
  
  <p>I have been looking into the Kubernetes implementation in <a href="https://github.com/kubernetes/kubernetes" rel="nofollow noreferrer">GitHub</a> and the <a href="https://github.com/kubernetes/client-go" rel="nofollow noreferrer">client-go</a> code but so far the only Go APIs I found is how to create deployments like stated <a href="https://github.com/kubernetes/client-go/blob/master/examples/create-update-delete-deployment/main.go#L66" rel="nofollow noreferrer">here</a> But instead I want to be able to reference an existing deployment in given k8s namespace and do <code>rollout restart</code>. </p>