Created
February 11, 2024 17:07
-
-
Save jpetazzo/63ad363937ce5b7d48ed4af8e06fe38b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
data: | |
authorized_keys: | | |
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID9Zt/CR+kt1omLPJmMLCJu1w3aIpg7IO0Vv7up+MVFI jp@hex | |
kind: ConfigMap | |
metadata: | |
name: shpod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: shpod | |
labels: | |
app: shpod | |
spec: | |
volumes: | |
- name: home | |
persistentVolumeClaim: | |
claimName: shpod | |
- name: pubkey | |
configMap: | |
name: shpod | |
containers: | |
- name: sshd | |
image: alpine | |
volumeMounts: | |
- name: home | |
mountPath: /home | |
- name: pubkey | |
mountPath: /home/user/.ssh | |
command: | |
- sh | |
- -c | |
- | | |
set -e | |
apk add openssh | |
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N "" | |
echo "StrictModes no" >> /etc/ssh/sshd_config | |
echo "group:x:1000:" >> /etc/group | |
echo "user:x:1000:1000::/home/user:/bin/sh" >> /etc/passwd | |
mkdir -p /home/user | |
chown user /home/user | |
exec /usr/sbin/sshd -D -e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
name: shpod | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1G |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: shpod | |
spec: | |
ports: | |
- name: ssh | |
port: 22 | |
protocol: TCP | |
targetPort: 22 | |
selector: | |
app: shpod | |
type: ClusterIP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed the connectivity issue with