Prerequisites
- Access to a working Workload Cluster (see Cluster API Workload Cluster (vSphere)) via
kubectl
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).
#Replace the value to match the name of your workload cluster
export WORKLOAD_CLUSTER_NAME="wlc01"
export KUBECONFIG="$HOME/$WORKLOAD_CLUSTER_NAME/kubeconfig"Create a development namespace
kubectl create namespace developmentCreate a simple deployment. The below will create a YAML file in the $HOME/Development directory.
mkdir -p $HOME/Development
tee $HOME/Development/my-nginx-deployment.yaml >/dev/null <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
EOFApply the Deployment, this will deploy nginx with the deployment name my-nginx-deployment.
kubectl apply -f "$HOME/Development/my-nginx-deployment.yaml" --namespace developmentCheck to see if our Deployment has been created. You should hopefully see all Pods READY and Running
kubectl get deployment -n development
kubectl get pod -n developmentAlternative imperative commands to create the same deployment, with a slightly different name.
kubectl create deployment my-nginx-deployment2 --image=nginx:1.14.2 --namespace=development
kubectl Previous Article in this Series: Cluster API Setup Steps (vSphere)




