2.3.2 - Can't create Service object because no rc
mrismailt opened this issue · 1 comments
The following app deployment code in 2.3.1
doesn't work because the generator flag has been deprecated:
kubectl run kubia --image=luksa/kubia --port=8080 --generator=run/v1
Therefore, we are forced to run the command without that flag, as follows:
kubectl run kubia --image=luksa/kubia --port=8080
This means that we don't end up creating a ReplicationController and thus, the following code from 2.3.2
for deploying a Service object of type LoadBalancer doesn't work:
k expose rc kubia --type=LoadBalancer --name kubia-http
What is the correct way to run the code from 2.3.1
to create a ReplicationController that would allow us to follow along with the remaining examples in the chapter?
ReplicationControllers have been deprecated in favor of ReplicaSets. However, you should not be creating these directly but instead managing them through Deployments. So, in order to continue following along with the book, the following code from the book:
kubectl run kubia --image=luksa/kubia --port=8080 --generator=run/v1
should be replaced with:
kubectl create kubia --image=luksa/kubia --port=8080
This will create a Deployment and you can use k get replicaset
to view the ReplicaSet (instead of the ReplicationController like shown in 2.3.4). Basically any example you come across in the book that uses an rc can (hopefully) be replaced with a ReplicaSet