All Projects → jpetazzo → shpod

jpetazzo / shpod

Licence: other
Container image to get a consistent training environment to work on Kubernetes.

Programming Languages

Dockerfile
14818 projects
shell
77523 projects
Vim Script
2826 projects

Projects that are alternatives of or similar to shpod

PagedLists
Paginated UITableView and UICollectionViews for iOS.
Stars: ✭ 69 (-35.51%)
Mutual labels:  pod
CXDatePickerView
一个自定义的日期时间选择器
Stars: ✭ 62 (-42.06%)
Mutual labels:  pod
kubecmd
Connect to your kubernetes' apps and run commands easily
Stars: ✭ 16 (-85.05%)
Mutual labels:  pod
ContextMenuSwift
A better version of iOS 13 Context Menu
Stars: ✭ 162 (+51.4%)
Mutual labels:  pod
kubernetes-scheduling-examples
Walk-through guide of advanced scheduling concepts in Kubernetes
Stars: ✭ 38 (-64.49%)
Mutual labels:  pod
opssight-connector
OpsSight Connector documentation
Stars: ✭ 15 (-85.98%)
Mutual labels:  pod
iOSUtilitiesSource
IOS Utilities Library for Swift
Stars: ✭ 46 (-57.01%)
Mutual labels:  pod
deploy-to-cocoapods-github-action
Github action for deploying to Cocoapods.org
Stars: ✭ 29 (-72.9%)
Mutual labels:  pod
GQImageVideoViewer
仿微信多图片及视频浏览器,图片和视频原尺寸显示,不会变形,双击图片放大缩小,单击消失,支持多张本地和网络图片以及网络视频混合查看,支持链式调用
Stars: ✭ 57 (-46.73%)
Mutual labels:  pod
rkt-compose
CLI to run Docker Compose file as pod on rkt with integrated service discovery using Consul - EOL
Stars: ✭ 24 (-77.57%)
Mutual labels:  pod
kubernetes-basico
Demonstração dos componentes do Kubernetes
Stars: ✭ 26 (-75.7%)
Mutual labels:  pod
QuickWebKit
A great & strong plugin based WebViewController. 一款基于插件的 WebView 视图控制器,您可以基于它设计您的浏览器插件,然后像积木一样来组装它们。
Stars: ✭ 29 (-72.9%)
Mutual labels:  pod
IDCardNumber-Validator
An Objective-C & Swift implementation to (check) validate Chinese ID Card No. 身份证号码验证
Stars: ✭ 15 (-85.98%)
Mutual labels:  pod
GoogleDriveBrowser
Goole Drive Download Library for iOS
Stars: ✭ 13 (-87.85%)
Mutual labels:  pod
CucumberSwift
A lightweight swift Cucumber implementation
Stars: ✭ 40 (-62.62%)
Mutual labels:  pod
MLLineChart
A simple Line Chart Lib
Stars: ✭ 28 (-73.83%)
Mutual labels:  pod
SSCycleScrollView
轮播终结者,用swift完成,易用集成
Stars: ✭ 39 (-63.55%)
Mutual labels:  pod
cocoapods-user-defined-build-types
⚒ A cocoapods plugin that can selectively set build type per pod (static library, dynamic framework, etc.)
Stars: ✭ 91 (-14.95%)
Mutual labels:  pod
ReSwiftMonitor
ReSwift+redeux dev tools
Stars: ✭ 13 (-87.85%)
Mutual labels:  pod
flowtorch
flowTorch - a Python library for analysis and reduced-order modeling of fluid flows
Stars: ✭ 47 (-56.07%)
Mutual labels:  pod

shpod

TL,DR: curl https://shpod.sh | sh

If you are looking for an image that works on the ARM architecture (like the Raspberry Pi or the Apple M1), have a look at BretFisher/shpod instead. Bret's fork is also a state-of-the-art example of a multi-arch Dockerfile!

What's this?

shpod is a container image based on the Alpine distribution and embarking a bunch of tools useful when working with containers, Docker, and Kubernetes.

It includes:

  • ab (ApacheBench)
  • bash
  • crane
  • curl
  • Docker CLI
  • Docker Compose
  • git
  • Helm
  • jid
  • jq
  • kubectl
  • kubectx + kubens
  • kube-linter
  • kube-ps1
  • kubeseal
  • kustomize
  • ngrok
  • popeye
  • regctl
  • ship
  • skaffold
  • skopeo
  • SSH
  • stern
  • tilt
  • tmux
  • yq

It also includes completion for most of these tools.

Its goal is to provide a normalized environment, to go with the training materials at https://container.training/, so that you can get all the tools you need regardless of your exact Kubernetes setup.

To use it, you need a Kubernetes cluster. You can use Minikube, microk8s, Docker Desktop, AKS, EKS, GKE, anything you like, really.

If it runs with a pseudo-terminal, it will spawn a shell, and you can attach to that shell. If it runs without a pseudo-terminal, it will start an SSH server, and you can connect to that SSH server to obtain the shell.

Using with a pseudo-terminal

Run it in a Pod and attach directly to it:

kubectl run shpod --restart=Never --rm -it --image=jpetazzo/shpod

This should give you a shell in a pod, with all the tools installed. Most Kubernetes commands won't work (you will get permission errors) until you create an appropriate RoleBinding or ClusterRoleBinding (see below for details).

Using without a pseudo-terminal

Run as a Pod (or Deployment), then expose (or port-forward) to port 22 in that Pod, and connect with an SSH client:

kubectl run shpod --image=jpetazzo/shpod
kubectl wait pod shpod --for=condition=ready
kubectl port-forward pod/shpod 2222:22
ssh -l k8s -p 2222 localhost # the default password is "k8s"

Note: you can change the password by setting the PASSWORD environment variable.

Granting permissions

By default, shpod uses the ServiceAccount of the Pod that it's running in; and by default (on most clusters) that ServiceAccount won't have much permissions, meaning that you will get errors like the following one:

$ kubectl get pods
Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:default:default" cannot list resource "pods" in API group "" in the namespace "default"

If you want to use Kubernetes commands within shpod, you need to give permissions to that ServiceAccount.

Assuming that you are running shpod in the default namespace and with the default ServiceAccount, you can run the following command to give cluster-admin privileges (=all privileges) to the commands running in shpod:

kubectl create clusterrolebinding shpod \
        --clusterrole=shpod \
        --serviceaccount=default:default

You can also use the one-liner below.

One-liner usage

The shpod.sh script will:

  • apply the shpod.yaml manifest to your cluster,
  • wait for the pod shpod to be ready,
  • attach to that pod,
  • delete resources created by the manifest when you exit the pod.

The manifest will:

  • create the shpod Namespace,
  • create the shpod ServiceAccount in that Namespace,
  • create the shpod ClusterRoleBinding giving cluster-admin privileges to that ServiceAccount,
  • create a Pod named shpod, using that ServiceAccount, with a terminal (so that you can attach to that Pod and get a shell).

To execute it:

curl https://raw.githubusercontent.com/jpetazzo/shpod/main/shpod.sh | sh

It's also available with short URLs:

curl https://shpod.sh | sh
curl https://shpod.me | sh

If you don't like curl|sh, and/or if you want to execute things step by step, check the next section.

Step-by-step usage

  1. Deploy the shpod pod:

    kubectl apply -f https://raw.githubusercontent.com/jpetazzo/shpod/main/shpod.yaml
    
  2. Attach to the shpod pod:

    kubectl attach --namespace=shpod -ti shpod
    
  3. Enjoy!

Clean up

If you are using the shell script above, when you exit shpod, the script will delete the resources that were created.

If you want to delete the resources manually, you can use kubectl delete -f shpod.yaml, or delete the namespace shpod and the ClusterRoleBinding with the same name:

kubectl delete clusterrolebinding,ns shpod

Opening multiple sessions

Shpod tries to detect if it is already running; and if it's the case, it will try to start another process using kubectl exec. Note that if the first shpod process exits, Kubernetes will terminate all the other processes.

Special handling of kubeconfig

If you have a ConfigMap named kubeconfig in the Namespace where shpod is running, it will extract the first file from that ConfigMap and use it to populate ~/.kube/config.

This lets you inject a custom kubeconfig file into shpod.

Support for other architectures

As of November 2021, the Dockerfile in this repository should be able to build images for other architectures. However, when trying to install a compiled binary that is not available for another architecture, a dummy placeholder will be installed instead.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].