My requirement is to have AMI with kubernetes installed so that i can launch it and start deploying app on it. I have created EC2 instance and then installed kubernetes (1.13) on it an then created image from that. I selected NO Reboot option. After creating image I created Ec2 instance with that AMI. But i dont see Kubernetes running on it.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7719d6f0e435 3cab8e1b9802 "etcd --advertise-cl…" 6 seconds ago Exited (1) 6 seconds ago k8s_etcd_etcd-master_kube-system_8c95e6c43816274c9b63c52c5558161e_15
d7f5413856be f07fae2c3e6a "kube-apiserver --au…" 32 seconds ago Exited (255) 11 seconds ago k8s_kube-apiserver_kube-apiserver-master_kube-system_6d85bc2d8c1849780bb3fd5c2316c14a_13
a83606b98160 90fd4a237264 "kube-controller-man…" About a minute ago Up About a minute k8s_kube-controller-manager_kube-controller-manager-master_kube-system_798f0580db1253017f8793d26dd60ce6_12
7308a4bcfaf9 54f3185a42a5 "kube-scheduler --ad…" About a minute ago Up About a minute k8s_kube-scheduler_kube-scheduler-master_kube-system_97bd2ffa08a518ac4f55aa68c229d9f1_12
c84e474fe245 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_kube-controller-manager-master_kube-system_798f0580db1253017f8793d26dd60ce6_12
9125f565a433 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_kube-scheduler-master_kube-system_97bd2ffa08a518ac4f55aa68c229d9f1_12
9f501723ec9c k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_kube-apiserver-master_kube-system_6d85bc2d8c1849780bb3fd5c2316c14a_12
532a568ea479 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_etcd-master_kube-syste
48147efed229 61de39f77f45 "/usr/bin/dumb-init …" 38 minutes ago Exited (255) 2 minutes ago k8s_ingress-controller_ingress-controller-767c485d4-qfpd8_model_701e8830-c551-11eb-9f8f-0239d268b535_11
062a3cac464f f59dcacceff4 "/coredns -conf /etc…" 38 minutes ago Exited (255) 2 minutes ago k8s_coredns_coredns-54ff9cd656-g5cmx_kube-system_a5b3c4db-c54f-11eb-9f8f-0239d268b535_11
63e1689d6e38 9c3111f27796 "/tiller" 38 minutes ago Exited (255) 2 minutes ago k8s_tiller_tiller-deploy-5b7c66d59c-cqcxq_kube-system_75ce666b-c550-11eb-9f8f-0239d268b535_11
68fafbc607c3 1c35c4412082 "sh -c 'chmod 777 /m…" 38 minutes ago Exited (0) 38 minutes ago k8s_init-server_nfs-server-d7b45f7cd-f6v9c_ao-namespace_aa8482d8-c550-11eb-9f8f-0239d268b535_0
d442713613fb f59dcacceff4 "/coredns -conf /etc…" 38 minutes ago Exited (255) 2 minutes ago k8s_coredns_coredns-54ff9cd656-rtjr8_kube-system_a5b23ac8-c54f-11eb-9f8f-0239d268b535_11
68e8210a6b81 k8s.gcr.io/pause:3.1 "/pause" 38 minutes ago Exited (255) 2 minutes ago k8s_POD_metrics-server-678f9dcb64-pbjs4_kube-system_da76bffe-c54f-11eb-9f8f-0239d268b535_69
UPDATE 1
I tried docker restart $(docker ps -a -q)
But not all container are up and see kubectl command timeout
My requirement is to have AMI with kubernetes installed so that i can launch it and start deploying app on it.
Havent you considered(asking cause dont know your full requirements) to use EKS for this purpose? Or you only limited with EC2?
This is not direct reply for your answer, closer to the 2nd option.
How do I create custom Amazon Linux AMIs for Amazon EKS?
To create a custom Amazon Linux AMI for Amazon EKS, you must use the following: