<p>I am trying to create Deployment from <code>client-go</code> but it is not creating and throwing an error as</p>

<pre><code>the server could not find the requested resource
</code></pre>

<p><em>My <code>client-go</code> version:</em> 4.0.0</p>

<p><em>My Kubernetes version is:</em></p>

<p><strong>Client Version:</strong></p>

<pre><code>version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.0", GitCommit:"fff5156092b56e6bd60fff75aad4dc9de6b6ef37", GitTreeState:"clean", BuildDate:"2017-03-28T16:36:33Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p><strong>Server Version:</strong> </p>

<pre><code>version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.3", GitCommit:"029c3a408176b55c30846f0faedf56aae5992e9b", GitTreeState:"clean", BuildDate:"2017-02-15T06:34:56Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>My sample code is </p>

<pre><code>package main

import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
intstr "k8s.io/apimachinery/pkg/util/intstr"
kube "k8s.io/client-go/kubernetes"
v1 "k8s.io/client-go/pkg/api/v1"
appsv1beta1 "k8s.io/client-go/pkg/apis/apps/v1beta1"
rest "k8s.io/client-go/rest"
"net"
)

var (
KubeMasterIP  = "x.x.x.x"
Port          = "xxxx"
UserName      = "xxxxx"
Password      = "xxxxxxxxxx"
TLSValue      = true
Protocol      = "https"
NameSpaceName = "test-namespace"
)

func main() {

fmt.Println("***************************")
buildAndDeployApp()
fmt.Println("***************************")
}

func buildAndDeployApp() {

tlsClientConfig := rest.TLSClientConfig{}
tlsClientConfig.Insecure = TLSValue
fmt.Println("HostPath: ", net.JoinHostPort(KubeMasterIP, Port))
restConfig := &amp;rest.Config{
    Host:            net.JoinHostPort(KubeMasterIP, Port),
    Username:        UserName,
    Password:        Password,
    TLSClientConfig: tlsClientConfig,
}

cSet, err := kube.NewForConfig(restConfig)
if err != nil {
    fmt.Println("Error in Kube clientSet : ", err.Error())
}

deploy, err := cSet.AppsV1beta1().Deployments(NameSpaceName).Create(BuildDeployment())
fmt.Println("Deploy Output: ", deploy)
fmt.Println("Error: ", err)
}

func int32Ptr(i int32) *int32 { return &amp;i }

func BuildDeployment() *appsv1beta1.Deployment {

return &amp;appsv1beta1.Deployment{
    ObjectMeta: metav1.ObjectMeta{
        Name: "test-deploy",
    },
    Spec: appsv1beta1.DeploymentSpec{
        Replicas: int32Ptr(1),
        Strategy: appsv1beta1.DeploymentStrategy{
            Type: "RollingUpdate",
            RollingUpdate: &amp;appsv1beta1.RollingUpdateDeployment{
                MaxSurge: &amp;intstr.IntOrString{
                    IntVal: 1,
                },
                MaxUnavailable: &amp;intstr.IntOrString{
                    IntVal: 1,
                },
            },
        },
        MinReadySeconds:      int32(5),
        RevisionHistoryLimit: int32Ptr(5),
        Template: v1.PodTemplateSpec{
            ObjectMeta: metav1.ObjectMeta{
                Labels: map[string]string{
                    "app": "demo",
                },
            },
            Spec: v1.PodSpec{
                Containers: []v1.Container{
                    {
                        Name:  "web",
                        Image: "nginx:1.13",
                        Ports: []v1.ContainerPort{
                            {
                                Name:          "http",
                                Protocol:      v1.ProtocolTCP,
                                ContainerPort: 80,
                            },
                        },
                        ImagePullPolicy: "Always",
                    },
                },
                RestartPolicy: "Always",
            },
        },
    },
}
}
</code></pre>

<p>apps/v1beta1 will not work in 1.5, its supported from 1.6. I used  extensions/v1beta1 to access deployments in 1.5.</p>
