<p>I manage a K8s-cluster, managed by terraform :</p>

<pre><code>Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:17:39Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:05:37Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>I want to delete a stack; so I removed the code and I applied. It throwed an error due to a timeout. I retried and I went successfully.</p>

<p>but now, I still have 2 replications controller (that are empty) :</p>

<pre><code>portal-api                                          0         0         0         2h
portal-app                                          0         0         0         2h
</code></pre>

<p>no more service, no more horizontal_pod_scheduler; but still my replication_controller.</p>

<p>I tried to remove them :</p>

<pre><code>$ kubectl delete rc portal-api                                                                                                      
error: timed out waiting for "portal-api" to be synced
</code></pre>

<p>Same if I want to force the deletion :</p>

<pre><code>$ kubectl delete rc portal-api --cascade=false --force=true
$ 
$ kubectl get rc
[...]
portal-api                                          0         0         0         2h
portal-app                                          0         0         0         2h
[...]
</code></pre>

<p>I also still can see its configuration (filled with a <code>deletionTimestamp</code>) :</p>

<pre><code>$ kubectl edit rc portal-api

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: ReplicationController
metadata:
  creationTimestamp: 2018-12-05T14:00:15Z
  deletionGracePeriodSeconds: 0
  deletionTimestamp: 2018-12-05T15:22:00Z
  finalizers:
  - orphan
  generation: 3
  labels:
    App: portal-api
  name: portal-api
  namespace: default
  resourceVersion: "32590661"
  selfLink: /api/v1/namespaces/default/replicationcontrollers/portal-api
  uid: 171f605e-f896-11e8-b761-02d4b8553a0e
spec:
  replicas: 0
  selector:
    App: portal-api
  template:
    metadata:
      creationTimestamp: null
      labels:
        App: portal-api
    spec:
      automountServiceAccountToken: false
      containers:
      - env:
        - name: AUTHORITY_MGR
          value: http://system-authority-manager-service
        image: gitlab.********************:4567/apps/portal/api:prd
        imagePullPolicy: Always
        name: portal-api
        ports:
        - containerPort: 3300
          protocol: TCP
        resources:
          limits:
            cpu: "1"
            memory: 512Mi
          requests:
            cpu: 500m
            memory: 256Mi
        terminationGracePeriodSeconds: 30
    status:
  replicas: 0
</code></pre>

<p>Could someone help me on this ? Any idea ? </p>

<p>thanks,</p>

Fred
<p>Using <code>kubectl edit rc portal-api</code> remove <code>finalizer</code> part from the resource:</p>

<pre><code>finalizers:
  - orphan
</code></pre>
