{"id":3939,"date":"2017-12-06T13:44:20","date_gmt":"2017-12-06T17:44:20","guid":{"rendered":"http:\/\/www.acarlstein.com\/?p=3939"},"modified":"2017-12-06T13:54:23","modified_gmt":"2017-12-06T17:54:23","slug":"kubectl-bash-commands","status":"publish","type":"post","link":"http:\/\/blog.acarlstein.com\/?p=3939","title":{"rendered":"Kubectl: Bash Commands"},"content":{"rendered":"<p>The following are some bash commands I made on the rush to make my life easier when working with Kubernetes.<br \/>\n These files have the extension TXT to prevent any possible issues in downloading them.<br \/>\n Note: Only for Linux\/Unix bash<\/p>\n<p> <a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3942\" rel=\"attachment wp-att-3942\">createtemp:\u00a0Create a temporary deployment (with a pod) based on the name provided.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl run -it &#8211;rm=true &lt;name&gt;&#8211;image=tutum\/curl &#8211;namespace &lt;environment&gt;<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3943\" rel=\"attachment wp-att-3943\">deldeploy:\u00a0Delete deployment in environment.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl &#8211;namespace=&lt;environment&gt; delete deployment &lt;deployment name&gt;<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3944\" rel=\"attachment wp-att-3944\">descpod:\u00a0Describe pod for specific environment.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl &#8211;namespace=&lt;environment&gt; describe pods\/&lt;pod name&gt;<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3945\" rel=\"attachment wp-att-3945\">lsconfigmaps:\u00a0List configmap(s) available based on environment provided.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl &#8211;namespace=&lt;environment&gt; get configmaps<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3946\" rel=\"attachment wp-att-3946\">lsdeploys:\u00a0List deployments(s) based on environment provided.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl &#8211;namespace=&lt;environment&gt; get deployments<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3947\" rel=\"attachment wp-att-3947\">lspods:\u00a0List pod(s) based on environment provided.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl &#8211;namespace=&lt;namespace&gt; get pods<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3948\" rel=\"attachment wp-att-3948\">podcp:\u00a0Copy files from\/to pod in an environment.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl cp &lt;source&gt; &lt;destination&gt; &lt;flags&gt;<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3949\" rel=\"attachment wp-att-3949\">podenv:\u00a0Show pod environment variables.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl &#8211;namespace=&lt;environment&gt; exec -it &lt;pod name&gt; env<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3950\" rel=\"attachment wp-att-3950\">podlog:\u00a0Show pod log.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl logs &lt;flags&gt; &lt;pod name&gt; &#8211;namespace=&lt;environment&gt;<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3951\" rel=\"attachment wp-att-3951\">podterm:\u00a0Open a Shell for a pod in a specific environment.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl &#8211;namespace=&lt;environment&gt; exec -it &lt;pod name&gt; sh<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3952\" rel=\"attachment wp-att-3952\">restartpod:\u00a0Restart pod in environment.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl &#8211;namespace=&lt;environment&gt; delete pods\/&lt;pod name&gt;<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3953\" rel=\"attachment wp-att-3953\">showconfigmap:\u00a0Show specific configmap based on specific environment.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl &#8211;namespace=&lt;environment&gt; get configmaps\/&lt;pod name&gt; -o=yaml<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.acarlstein.com\/?attachment_id=3954\" rel=\"attachment wp-att-3954\">shpod:\u00a0Run a command line in the pod&#8217;s shell.<\/a><\/p>\n<ul>\n<li>Equivalent to run: kubectl exec &lt;pod name&gt; &#8211;namespace=&lt;environment&gt; &#8212; &lt;command line(s)&gt;<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n\n<script>\nvar zbPregResult = '0';\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>The following are some bash commands I made on the rush to make my life easier when working with Kubernetes. These files have the extension TXT to prevent any possible issues in downloading them. Note: Only for Linux\/Unix bash createtemp:\u00a0Create a temporary deployment (with a pod) based on the name provided. Equivalent to run: kubectl [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,1554],"tags":[1552,1553,1551,124],"class_list":["post-3939","post","type-post","status-publish","format-standard","hentry","category-programming","category-bash","tag-bash","tag-kubectl","tag-kubernetes","tag-linux"],"_links":{"self":[{"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=\/wp\/v2\/posts\/3939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3939"}],"version-history":[{"count":7,"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=\/wp\/v2\/posts\/3939\/revisions"}],"predecessor-version":[{"id":3960,"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=\/wp\/v2\/posts\/3939\/revisions\/3960"}],"wp:attachment":[{"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3939"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.acarlstein.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}