Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap order of service and rc, and explain why. #11179

Merged
merged 1 commit into from
Jul 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 17 additions & 15 deletions docs/user-guide/managing-deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ Many applications require multiple resources to be created, such as a Replicatio

```yaml
apiVersion: v1
kind: Service
metadata:
name: my-nginx-svc
labels:
app: nginx
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: nginx
---
apiVersion: v1
kind: ReplicationController
metadata:
name: my-nginx
Expand All @@ -37,31 +50,20 @@ spec:
image: nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: my-nginx-svc
labels:
app: nginx
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: nginx
```

Multiple resources can be created the same way as a single resource:
```bash
$ kubectl create -f nginx-app.yaml
replicationcontrollers/my-nginx
services/my-nginx-svc
replicationcontrollers/my-nginx
```

The resources will be created in the order they appear in the file. Therefore, it's best to specify the service first, since that will ensure the scheduler can spread the pods associated with the service as they are created by the replication controller(s).

`kubectl create` also accepts multiple `-f` arguments:
```bash
$ kubectl create -f nginx-rc.yaml -f nginx-svc.yaml
$ kubectl create -f nginx-svc.yaml -f nginx-rc.yaml
```

And a directory can be specified rather than or in addition to individual files:
Expand Down