kubernetes - kubectl run vs create and apply

前端 未结 1 960
栀梦
栀梦 2020-12-24 12:21

I\'m just getting started with kubernetes and setting up a cluster on AWS using kops. In many of the examples I read (and try), there will be commands like:



        
相关标签:
1条回答
  • 2020-12-24 12:39

    The fundamental question is how to apply all of the K8s objects into the k8s cluster. There are several ways to do this job.

    • Using Generators (Run, Expose)
    • Using Imperative way (Create)
    • Using Declarative way (Apply)

    All of the above ways have a different purpose and simplicity. For instance, If you want to check quickly whether the container is working as you desired then you might use Generators .

    If you want to version control the k8s object then it's better to use declarative way which helps us to determine the accuracy of data in k8s objects.

    Deployment, ReplicaSet and Pods are different layers which solve different problems.All of these concepts provide flexibility to k8s.

    • Pods: It makes sure that related containers are together and provide efficiency.
    • ReplicaSet: It makes sure that k8s cluster has desirable replicas of the pods
    • Deployment: It makes sure that you can have different version of Pods and provide the capability to rollback to the previous version

    Lastly, It depends on use case how you want to use these concepts or methodology. It's not about which is good or which is bad.

    0 讨论(0)
提交回复
热议问题