No Declared merge key error when trying to modify a deployment in Kubernetes

0 votes

I have a deployment and wished to modify it a little bit. I've used the following command for it

kubectl -n <namespace> edit deployment <depolyment_name>.

But I just ended up with the following error:

A copy of your changes has been stored to "/tmp/kubectl-edit-hv5dh.yaml"
error: map: map[] does not contain declared merge key: name

Deployment file:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
    federation.alpha.kubernetes.io/federation-name: fed
  creationTimestamp: 2019-04-01T13:26:40Z
  generation: 1
  labels:
    app: cluster
  name: apiserver
  namespace: system
  resourceVersion: "393140"
  selfLink: /apis/extensions/v1beta1/namespaces/federation-system/deployments/apiserver
  uid: <uid>
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: cluster
      module: apiserver
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      annotations:
        federation.alpha.kubernetes.io/federation-name: fed
      creationTimestamp: null
      labels:
        app: cluster
        module: apiserver
      name: apiserver
    spec:
      containers:
      - command:
        - /fcp
        - federation-apiserver
        - --admission-control=NamespaceLifecycle
        - --advertise-address=<master-ip>
        - --bind-address=0.0.0.0
        - --client-ca-file=/etc/federation/apiserver/ca.crt
        - --etcd-servers=http://localhost:2379
        - --secure-port=8443
        - --tls-cert-file=/etc/federation/apiserver/server.crt
        - --tls-private-key-file=/etc/federation/apiserver/server.key
        - --enable-admission-plugins=SchedulingPolicy
        - --admission-control-config-file=/etc/kubernetes/admission/config.yml**
        image: gcr.io/k8s-jkns-e2e-gce-federation/fcp-amd64:v1.9.0-alpha.3
        imagePullPolicy: IfNotPresent
        name: apiserver
        ports:
        - containerPort: 8443
          name: https
          protocol: TCP
        - containerPort: 8080
          name: local
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/federation/apiserver
          name: apiserver-credentials
          readOnly: true
        volumeMounts:
        - mountPath: /etc/kubernetes/admission
          name: admission-config**
      - command:
        - /usr/local/bin/etcd
        - --data-dir
        - /var/etcd/data
        image: gcr.io/google_containers/etcd:3.1.10
        imagePullPolicy: IfNotPresent
        name: etcd
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - {}
      restartPolicy: Always
      schedulerName: scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: credentials
        secret:
          defaultMode: 420
          secretName: credentials
        - name: admission-config
        configMap:
          name: admission**
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: 2018-04-01T13:26:40Z
    lastUpdateTime: 2018-04-01T13:26:40Z
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: 2018-04-01T13:26:40Z
    lastUpdateTime: 2018-04-01T13:27:20Z
    message: ReplicaSet "apiserver-8484fd45f8" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 1
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1​
Jan 4, 2019 in Kubernetes by Ali
• 11,360 points
7,559 views

1 answer to this question.

0 votes
I see you have a section in your deployment that uses ImagePullSecrets, delete that part.

ImagePullSecrets has been blocking the merge key you require. This condition has been round-tripping the yaml file thought the editor.
answered Jan 4, 2019 by Kim

Related Questions In Kubernetes

0 votes
1 answer
0 votes
1 answer

image can't be pulled error when I try to pull a docker image - kubernetes

I think the image is being pulled ...READ MORE

answered Sep 4, 2018 in Kubernetes by Kalgi
• 52,360 points
6,137 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
15,297 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,923 views
0 votes
1 answer

Code error 403 when trying to access Kubernetes cluster

You get this error because you're getting ...READ MORE

answered Jan 4, 2019 in Kubernetes by Kabeer
24,592 views
0 votes
1 answer

Error in syncing pod - Kubernetes

You are getting this error because all you're ...READ MORE

answered Jan 4, 2019 in Kubernetes by Layla
5,994 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP