Error from server (NotFound): replicationcontrollers "kubia-liveness" not found

2/14/2018

I have created pods using below yaml.

apiVersion: v1
kind: Pod
metadata:
  name: kubia-liveness
spec:
  containers:
   - image: luksa/kubia-unhealthy
    name: kubia
     livenessProbe:
      httpGet:
       path: /
       port: 8080

Then I created pods using the below command.

$ kubectl create -f kubia-liveness-probe.yaml

It created a pod successfully.

Then I'm trying to create load balancer service to access from the external world. For that I'm using the below command.

$ kubectl expose rc kubia-liveness --type=LoadBalancer --name kubia-liveness-http

For this, I'm getting below error.

Error from server (NotFound): replicationcontrollers "kubia-liveness" not found

I'm not sure how to create replicationControllers. Could anybody please give me the command to do the same.

-- Rajkumar Natarajan
google-kubernetes-engine
kubernetes

1 Answer

2/15/2018

You are mixing two approaches here, one is creating stuff from yaml definition, which is good by it self (but bare in mind that it is really rare to create a POD rather then Deployment or ReplicationController) with exposing via CLI, which has some assumptions made (ie. it expects replication controller) and with these assumptions it creates appropriate service. My suggestion would be to go for creating Service from yaml manifest as well, so you can tailor it to fit your case.

-- Radek 'Goblin' Pieczonka
Source: StackOverflow