InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search
  • Home
  • > Kubernetes

Mac – create a one container pod and get shell to it

on Dec 31, 2022

Steps to create a pod with nginx container and get shell to it:

  1. Create config file shell-demo.yaml
    apiVersion: v1
    kind: Pod
    metadata:
      name: shell-demo
    spec:
      volumes:
      - name: shared-data
        emptyDir: {}
      containers:
      - name: nginx
        image: nginx
        volumeMounts:
        - name: shared-data
          mountPath: /usr/share/nginx/html
      hostNetwork: true
      dnsPolicy: Default
  2. Create the pod
    kubectl apply -f shell-demo.yaml
  3. Get a shell to the running container (container name will be needed in case more than one containers in pod)
    kubectl exec --stdin --tty shell-demo -- /bin/bash
  4. Create a root page for nginx (in shell window)
    echo 'Hello shell demo' > /usr/share/nginx/html/index.html
  5. Install curl and test the site
    apt-get update
    apt-get install curl
    curl http://localhost/

    The output should show:
    Hello shell demo

Suggested posts:

  1. Mac – enable and use kubernetes in docker
  2. Docker container – handy commands
  3. Mac docker – create getting-started image and run container using it
  4. Chrome extension tutorial – access active page dom
  5. How to view desktop site from android mobile
  6. Docker how to add a user to group docker on Linux
  7. Mac kubernetes – create two container pod with shared volume
  8. Mac podman quick start guide
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Kubernetes, Mac Docker
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress