{"id":3300,"date":"2018-07-30T21:11:34","date_gmt":"2018-07-31T02:11:34","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=3300"},"modified":"2018-07-30T21:11:34","modified_gmt":"2018-07-31T02:11:34","slug":"kubernetes-using-manifest-files-to-deploy","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=3300","title":{"rendered":"Kubernetes &#8211; Using Manifest Files To Deploy"},"content":{"rendered":"<p>While I&#8217;ve manually configured Kubernetes to create proof-of-concept sandbox systems, that is an inefficient approach for production systems. The kubectl create command can use a yaml file (or json, if you prefer that format). I maintain my manifests in a Git repository so changes can be tracked (and so I know where to find them!). Once you have a manifest, it&#8217;s a matter of using &#8220;kubectl create -f manifest1.yaml&#8221; or &#8220;kubectl create -f manifest1.yaml -f manifest2.yaml &#8230; -f manifestN.yaml&#8221; to bring the &#8216;stuff&#8217; online.<\/p>\n<p>But what goes into a manifest file? The following file would deploy four replicas of the sendmail container that is retained in my private registry.<\/p>\n<p>If the namespaces have not been created,<\/p>\n<pre>apiVersion: v1\r\nkind: Namespace\r\nmetadata:\r\n  name: sendmailtest\r\n<\/pre>\n<p>The command &#8220;kubectl get ns&#8221; will list namespaces on the cluster. Note that &#8216;deployment&#8217; items were not available in the v1 API, so the v1beta1 version needs to be specified to configure a deployment.<\/p>\n<pre>---\r\napiVersion: v1\r\nkind: Pod\r\nmetadata:\r\n  name: sendmail\r\n  namespace: sendmailtest\r\n  labels:\r\n    app: sendmail\r\nspec:\r\n  containers:\r\n    - name: sendmail\r\n      image: sendmail\r\n      ports:\r\n        - containerPort: 25\r\n---\r\napiVersion: v1beta1\r\nkind: Deployment\r\nmetadata:\r\n  name: sendmail\r\nspec:\r\n  replicas: 4\r\n  template:\r\n    metadata:\r\n      labels:\r\n        app: sendmail\r\n    spec:\r\n      containers:\r\n        - name: sendmail\r\n          image: 'rushworthdockerregistry\/sendmail\/sendmail\/sendmail:latest'\r\n          ports:\r\n            - containerPort: 25\r\n\r\n---\r\napiVersion: v1\r\nkind: Service\r\nmetadata:\r\n  name: sendmail-service\r\n  labels:\r\n    name: sendmail-service\r\nspec:\r\n  ports:\r\n    - port: 25\r\n      targetPort: 25\r\n      protocol: TCP\r\n      name: smtp\r\n  selector:\r\n    app: sendmail\r\n  type: ClusterIP<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While I&#8217;ve manually configured Kubernetes to create proof-of-concept sandbox systems, that is an inefficient approach for production systems. The kubectl create command can use a yaml file (or json, if you prefer that format). I maintain my manifests in a Git repository so changes can be tracked (and so I know where to find them!). &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[623],"tags":[624,615],"class_list":["post-3300","post","type-post","status-publish","format-standard","hentry","category-containerized-development-and-deployment","tag-kubectl","tag-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3300"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3300\/revisions"}],"predecessor-version":[{"id":3301,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3300\/revisions\/3301"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}