Add deploy manifests (#48)

Signed-off-by: Jian Qiu <jqiu@redhat.com>
This commit is contained in:
Jian Qiu
2022-05-18 16:59:01 +08:00
committed by GitHub
parent 6e8fd2efba
commit d4da5acfcf
6 changed files with 42 additions and 15 deletions

View File

@@ -8,10 +8,9 @@ hubctx="kind-hub"
kubectl config use ${hubctx}
echo "Add cluster1, cluster2 to the clusterset"
echo "Bind clusterset to default namespace"
kubectl label managedcluster cluster1 cluster.open-cluster-management.io/clusterset=app-demo --overwrite
kubectl label managedcluster cluster2 cluster.open-cluster-management.io/clusterset=app-demo --overwrite
clusteradm clusterset bind default --namespace default
echo "Label cluster1 so placement will select cluster1 only"

View File

@@ -1,4 +0,0 @@
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: ManagedClusterSet
metadata:
name: app-demo

View File

@@ -1,7 +0,0 @@
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: ManagedClusterSetBinding
metadata:
name: app-demo
namespace: default
spec:
clusterSet: app-demo

View File

@@ -6,7 +6,7 @@ metadata:
spec:
numberOfClusters: 1
clusterSets:
- app-demo
- default
predicates:
- requiredClusterSelector:
labelSelector:

View File

@@ -0,0 +1,19 @@
# Deploy manifests to a managed cluster
## Prerequisite
Set up the dev environment in your local machine following [setup dev environment](../setup-dev-environment).
## Run the clusteradm command to deploy an nginx deployment to a cluster
```
clusteradm create work nginx -f manifests/nginx.yaml --cluster cluster1
```
Now will see that nginx deployment is applied on cluster1. To update the existing nginx deployment on the cluster, run:
```
clusteradm create work nginx -f manifests/nginx.yaml --cluster cluster1 --overwrite
```
it will update the nginx deployment on the cluster1.

View File

@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: default
spec:
selector:
matchLabels:
app: nginx
replicas: 2 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80