Kubernetes > Sample tasks > Mediawiki deployment on a separate namepsace
Create a namespace
shakir@k8s-master:~ cat ex30-ns-mediawiki.yaml
---
apiVersion: v1
kind: Namespace
metadata:
name: ns30-mediawiki
...
shakir@k8s-master:~ kubectl create -f ex30-ns-mediawiki.yaml
namespace/ns30-mediawiki created
shakir@k8s-master:~ kubectl get ns | grep mediawiki
ns30-mediawiki Active 15s
Create a deployment in the namespace
shakir@k8s-master:~ cat ex30-deploy-mediawiki.yaml
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: deploy30-mediawiki
namespace: ns30-mediawiki
spec:
selector:
matchLabels:
tag: label30
template:
metadata:
labels:
tag: label30
spec:
containers:
- name: ctr30-mediawiki
image: mediawiki:stable
...
shakir@k8s-master:~ kubectl create -f ex30-deploy-mediawiki.yaml
deployment.extensions/deploy30-mediawiki created
shakir@k8s-master:~ kubectl get deploy -n ns30-mediawiki
NAME READY UP-TO-DATE AVAILABLE AGE
deploy30-mediawiki 1/1 1 1 16s
Verify Pods and CURL
shakir@k8s-master:~ kubectl get pods -n ns30-mediawiki
NAME READY STATUS RESTARTS AGE
deploy30-mediawiki-775dc7df7-9j8bx 1/1 Running 0 4m15s
shakir@k8s-master:~ kubectl exec -it deploy30-mediawiki-775dc7df7-9j8bx -n ns30-mediawiki curl localhost | head
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>MediaWiki 1.33.0</title>
<style media="screen">
body {
color: #000;
background-color: #fff;
font-family: sans-serif;
--end-of-post--