Is there anyway to create ReplicationController or ReplicaSet using `kubectl` c . . .

Jayesh Jose:
Is there anyway to create ReplicationController or ReplicaSet using kubectl command line ?.

Pranay:
As far as I know - NO , in but you can create a deployment yaml (using kubectl) and than edit it as you need

To convert Deployment to ReplicaSet do :

Change kind ‘Deployment’ to ‘ReplicaSet’ , remove - strategy and status entities

2c2
< kind: ReplicaSet
---
> kind: Deployment
12a13
>   strategy: {}
22a24
> status: {}

To convert Deployment to ReplicationController to :

Change kind ‘Deployment’ to ‘ReplicationController’ & apiVersion from apps/v1 to just v1, remove ‘matchLabels’, and just like ReplicaSet remove - strategy and status entities

1,2c1,2
< apiVersion: v1
< kind: ReplicationController
---
> apiVersion: apps/v1
> kind: Deployment
10a11
>     matchLabels:
11a13
>   strategy: {}
21a24
> status: {}

In other words if you know the difference between - deployment , replicaSet and ReplicationController you can get appropriate yaml easily .
Same goes for creating DaemonSet and StatefulSet .

Best - during exam if you are asked to create one of above - just ‘wget’ - sample YAML from docs and then edit it locally and apply it : ReplicationController https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/controllers/replication.yaml , Replica set : https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/controllers/frontend.yaml - one of the reason kubernetes doc now has links next to sample YAML is for you to quickly grab that yaml text as it is (without fiddling with copy / paste and messing around with indentation of pesky yaml )

Now you have choice !

Jayesh Jose:
Thank you very much @Pranay for the detail writeup on this , very helpful info . One final question are we allowed to use content from github for exam ? or should I use the k8s github alias URL eg - kubectl apply -f <https://k8s.io/examples/controllers/replication.yaml>

Pranay:
If the link is there in k8s doc - as given on top right corner (in sample yaml) - you are fine to use those - copy link and just wget in your exam terminal
Read below from CNCF , as per them https://github.com/kubernetes/website/tree/master/content/en/examples is okay to us

https://docs.linuxfoundation.org/tc-docs/certification/tips-cka-and-ckad

Jayesh Jose:
Thank you !!