<p>I am trying to create a replicaset with kubernetes. This time, I don't have a yml file and this is why I am trying to create the replicaset using a command line.
Why <code>kubectl create replicaset somename --image=nginx</code> raise an error, and how to fix this?</p>

<p>You cannot create <code>replicaset</code> using the command line. Only the following resource creation is possible using <code>kubectl create</code>:</p>
<pre><code>kubectl create  --help |awk '/Available Commands:/,/^$/'
Available Commands:
  clusterrole         Create a cluster role
  clusterrolebinding  Create a cluster role binding for a particular cluster role
  configmap           Create a config map from a local file, directory or literal value
  cronjob             Create a cron job with the specified name
  deployment          Create a deployment with the specified name
  ingress             Create an ingress with the specified name
  job                 Create a job with the specified name
  namespace           Create a namespace with the specified name
  poddisruptionbudget Create a pod disruption budget with the specified name
  priorityclass       Create a priority class with the specified name
  quota               Create a quota with the specified name
  role                Create a role with single rule
  rolebinding         Create a role binding for a particular role or cluster role
  secret              Create a secret using specified subcommand
  service             Create a service using a specified subcommand
  serviceaccount      Create a service account with the specified name
</code></pre>
<p>Although, You may use the following way to create the replica set, in the below example, <code>kubectl create -f</code> is fed with stdout(<code>-</code>):</p>
<pre><code>echo &quot;apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: frontend
  labels:
    app: guestbook
    tier: frontend
spec:
  # modify replicas according to your case
  replicas: 3
  selector:
    matchLabels:
      tier: frontend
  template:
    metadata:
      labels:
        tier: frontend
    spec:
      containers:
      - name: php-redis
        image: gcr.io/google_samples/gb-frontend:v3
&quot; |kubectl create  -f -
</code></pre>
