Skip to content
samperrin.com, home
Development

Deploying your first App into a Workload Cluster

Deploy your first App in to the workload cluster that was deployed with Cluster API

1 min read

Prerequisites

Set your kubeconfig so you can access the workload cluster.

If you followed the steps in the linked article above, you should hopefully have the environment variable $WORKLOAD_CLUSTER_NAME already set, and its kubeconfig file is located in $HOME/$WORKLOAD_CLUSTER_NAME/kubeconfig.

This step assumes you followed Cluster API Workload Cluster (vSphere).

Shell
#Replace the value to match the name of your workload clusterexport WORKLOAD_CLUSTER_NAME="wlc01"export KUBECONFIG="$HOME/$WORKLOAD_CLUSTER_NAME/kubeconfig"

Create a development namespace

Shell
kubectl create namespace development

Create a simple deployment. The below will create a YAML file in the $HOME/Development directory.

Shell
mkdir -p $HOME/Developmenttee $HOME/Development/my-nginx-deployment.yaml >/dev/null <<EOFapiVersion: apps/v1kind: Deploymentmetadata:  name: my-nginx-deployment  labels:    app: nginxspec:  replicas: 3  selector:    matchLabels:      app: nginx   template:    metadata:      labels:        app: nginx    spec:      containers:      - name: nginx        image: nginx:1.14.2        ports:        - containerPort: 80EOF

Apply the Deployment, this will deploy nginx with the deployment name my-nginx-deployment.

Shell
kubectl apply -f "$HOME/Development/my-nginx-deployment.yaml" --namespace development

Check to see if our Deployment has been created. You should hopefully see all Pods READY and Running

Shell
kubectl get deployment -n developmentkubectl get pod -n development

Alternative imperative commands to create the same deployment, with a slightly different name.

Shell
kubectl create deployment my-nginx-deployment2 --image=nginx:1.14.2 --namespace=developmentkubectl 

Previous Article in this Series: Cluster API Setup Steps (vSphere)